How to launch PHP script at startup on RHEL?
I've got a PHP script I'd like to launch when my RHEL server boots up.
Should I just add this line to /etc/rc.d/rc.local? Code:
php -q /path/to/my/script.php > /path/to/output.txt |
That would do it, but note it won't shutdown cleanly, it'll probably just get killed.
If you want a more controlled/nice shutdown, copy one of the other scripts in /etc/init.d and adapt it to start & stop your process. |
chrism01, I appreciate your suggestion and am definitely interested in an orderly shut down because my script locks batches of records in a database for processing. Should the server start to shut down, it should unlock any records it has locked so that some other process/machine might work on those records.
I've been looking at the fail2ban init script which looks like it uses bash rather than sh. It's kind of greek to me, though. Any suggestions on where to learn what this stuff means? Code:
#!/bin/bash |
1. compare that with a few others and you'll see a fairly std structure, then you just put your stuff instead of fail2ban etc
2. have a read of this http://www.tldp.org/HOWTO/HighQualit...OWTO/boot.html |
All times are GMT -5. The time now is 01:59 AM. |