I've written 2 php scripts one worker and one master.
If I run master manually it checks a rabbitmq system and spawns 1 worker for each queue it detects. Then if I run master again it checks see if the each worker process is still running if it is then it does nothing if not then it restarts it.
Fairly simple concept I'd have thought. I achieved it using nohup and & in the master for each child it spawns, now as I'm sure you can guess i want to run master every 60 seconds to check the queues are alive and respawn them if they're not.
This gives me the problem of I can't use nohub in cron jobs and just using & on its own doesn't seem to work. As far as I can tell the workers aren't even execing with the call
I've tried creating a separate shell script that then calls master.php also didn't work. I tried creating it as an upstart task then remembered that in ubuntu 17+ upstart is removed.
I'm open to any suggestions of different ways of doing this but whatever route I take it must allow my master.php to spawn the work.php files as headless background processes.
master
script to be running constantly, with asleep 60
between each check?master
may also be vulnerable.