I need to run two commands sequentially in daemon mode (the commands will output the errors on stderr). The problem is that even I dump all the output in /dev/null, the second command (run_cmd2) cannot be invoked. Here is my script
#! /bin/bash
nohup ./run_cmd1 &> /dev/null &
nohup ./run_cmd2 &> /dev/null &
Any ideas? Thank you in advance.
How about using a file to communicate state?
run_cmd2 will wait until a file exists before running
when run_cmd1 is done, it will create the said file.
at the end of its run the run_cmd2 will delete the file, so run_cmd1 can run again
Or maybe they talk to each other using a port?
Or maybe a semaphore?
For more details: http://www.tldp.org/LDP/tlk/ipc/ipc.html