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?

1
  • 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? Apr 26, 2019 at 9:58

1 Answer 1

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

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .