nothing really to do with php, but im a little stuck. ive written a small php server that runs as a deamon. i can get this deamon started and running in the background using;
./server.php &
what i would like to do is make a .sh script that will kill this deamon. i know how to construct 'select' statements in bash, but i need a way to capture the pid of this deamon on startup, so that when i call it again to kill it i can kill the right process.
i want to be able to issue command such as;
./server.sh --start
./server.sh --restart
./server.sh --stop
anyone know how to store the pid in a text file on --start, so i could use it again in --restart and --stop?