I start a command via nohup <command> &
on the server via SSH and currently, I have to manually kill the process after a given time via
ps -ef | grep <command>
kill <pid>
Is there a way to use some kind of timeout with a process started with nohup
after a given time?
Best way would be a one-liner that works on Ubuntu.
nohup timeout 10 ping google.com &
Not really much explanation to give. nohup x &
runs the command in the background even if the terminal is closed. timeout y
autokills the command after y seconds. Neat.