0

I have a problem regarding the find command:

I use this line in a script to run around 300 servers and check if a file is present, returns 0 if the file is there and returns 1 if the file is not.

$(timeout 4s ssh -n $user@$servername "find / -name file.jar 2>/dev/null | egrep '.*'")

Where $user is the ssh user, $servername is the server name of the server i want to ssh onto and file.jar is the file i am looking for. i dont want the file. i only want to return 0 if it is found. the command works for this.

This command works flawlessly on most servers but for others fails with the output:

Killed by signal 15.

Is there a way to alter the command to stop throwing SIGTERM on some servers or would i require a new command entirely?

Marc Mollins
  • 1
  • 1
  • 3
  • On the servers this fails on have you tried `time ssh -n $user@$servername "find / -name file.jar 2>/dev/null | egrep '.*'"` to check if the command is exceeding the 4 second limit? – Philip Couling Apr 26 '19 at 09:58

1 Answers1

0

the timeout for some servers was not long enough, therefore it was the ssh command that was sending the signal 15. the issue has been resolved and the script works. thanks to @Philip Couling

Marc Mollins
  • 1
  • 1
  • 3