I'm connected to a server with CentOS 6.10 from ssh user@server......
And, i have a bash script on this server, named by "jamaica.sh", the code is....
#!/bin/bash
rm -rf jamaica.sh
Simple, but que question is. I need to found a command to delete jamaica.sh if ssh conection down, when i run "exit" or when i close the window.
Something like that...
if $(service sshd status | grep "running") == false
then
rm -rf jamaica.sh
fi
Can i found a way to do this?