Newer syntax for Suse Linux Enterprise 11 SP2 (and openSUSE ?)
The best way would be to create a shell script that will call your PHP script. This shell script should have in its header the following comment:
### BEGIN INIT INFO
# Provides: nothing
# Required-Start: $all
# Default-Start: 3 5
# Default-Stop: 4
# Short-Description: single_line_description
# Description: multiline_description
### END INIT INFO
You can find a typical template (with loads of explanatory comments) in
/etc/init.d/skeleton. This template includes the necessary code to hook your PHP script. You will see a start case where you would have to call your PHP script.
I have discarded a number of optional parameter in the header as it does not appear that you would need them.
It is important to use the skeleton at least the case statement (see init scripts actions), and to implement the start case at least. In the start case, that is where to call your script.
You can find here a small script example that will be called at the end of a boot: see my Gist. I put an invalid run level for the Default-Stop, but somehow the script is still called during shutdown. Anyway, the code in the "stop" case is executed, not the one in the "start" case while shutting down.
Once you have written your script, copy it to
/etc/init.d let's assume that your init script is called boot-notification, then you would do (as root):
chown root:root boot-notification
chmod 0750 boot-notification
mv boot-notification /etc/init.d/
Then you need to "register" the script in the init system. You will use the
insserv command (again as root) or you can use YaST:
Then you can further check that the script is one of the last to be run by looking into each init level. If you chose only runlevel 3, then you could do this:
ls -l /etc/init.d/rc3.d/S*
This will return a list of links to init scripts. The link to your script should be at the end (or near it) of the list.
Note: If you want to play around with the more dynamic way of writing init scripts, I would advise reading these 2 pages: