Answer the question
In order to leave comments, you need to log in
Starting and stopping scripts with a loop?
Good afternoon.
I have a script with an infinite loop. I can't just run it (I run it on hosting via ssh) because as soon as I close the console, the script exits. I solved this problem using cron, everything works fine.
Now I encountered such a problem - in order to leave this script, I will have to kill the php process, and not 1 script with a cycle is running there, I have to raise all the scripts again through cron, which is very inconvenient and I have to run 10 files from 1 line again. Maybe there are some ideas?
Answer the question
In order to leave comments, you need to log in
nohup
. For example like this:nohup php ./myscript.php &
getmypid
, get the process id, save it to a pid file, and kill only that process.Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question