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?
time ssh -n $user@$servername "find / -name file.jar 2>/dev/null | egrep '.*'"
to check if the command is exceeding the 4 second limit?