Can I make a bash command line that only runs a certain command if the process is not already running (in the background)?
How do I check*, if a command is already running?
(so I can add the next command with &&
in between them so the next one only executes if the first one is true).
*: test, determine, discover, find out
Best Answer
Use daemontools. You can use
svok
to check whether a service/daemon/background process is currently running.For other methods see: