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.

ImportantIt 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):

I did not follow your steps 100% I only used your new headers for the script and now I can see the description in yast. My problem is that the script is triggers before the reboot and after. I do not want it happen before.
–
RadekJul 19 '12 at 23:10

YaST has probably added the script to the reboot and shutdown init. If you use the skeleton (check the openSuse link, it contains a simpler one, look in the 'Action' section). You have to be sure that when start is invoke, you call your PHP script. When stop is invoke, you don't call it. Or you can use @Petr-Uzel solution too, then you simply call your PHP script, no need to apply the skeleton structure.
–
HuygensJul 20 '12 at 9:34

Would you know how to check if calling the script is part of shutdown init?
–
RadekJul 23 '12 at 0:21

1

@Radek when shutting down or rebooting, the runlevel change to (respectively) 0 or 6. If you have the script in /etc/init.d/rcn.d/K* with n equal 0 or 6, then it is called during the shutdown. I have added a gist (see link in my answer) with a simple script you could re-use to call your PHP script.
–
HuygensJul 23 '12 at 7:15

After checking, the runlevel for shutting down and reboot are correct, however, the scripts are not place there. But in their respective start runlevel. So if you put the runlevel 3 to start the script, then in runlevel 3 you will see the shutdown script, the difference is that for startup, the link to the script is S<nn><filename> whereas for the shuttdown it is K<nn><filename>
–
HuygensJul 23 '12 at 7:32

(open)SUSE uses /etc/init.d/after.local for this purpose. Just add the commands you need to be executed into that file. Note that this works fine with SystemV init, but with systemd this would need AFAIK need to be solved differently.

You can find a typical template (with loads of explanatory comments) in /etc/init.d/skeleton.compat (that one supports the chkconfig syntax, you have also 7etc/init.d/skeleton which supports newer LSB standard, but it is a bit more complicate to explain you how to set it up, though it is more powerful). 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.

The important number I gave you are on the chkconfig line.

35: means that this script will be called in either init 3 (console mode, usual for server) or init 5 (graphical mode, more common for desktop)

99: is the priority in either init 3 or 5. It means that it will be called last. Note that some other boot scripts could be called with a priority 99.

00: is the priority for shutdown/reboot. You could also have a notification as soon as the system is going 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):

I created a script, copied into /etc/init.d and registered via yast for runlevel 3 & 5. Now it is triggered before reboot starts and after it finishes. Then I added the header you suggested but it still sends out message before booting. Any idea how to stop that?
–
RadekJul 19 '12 at 0:36

OK, YaST does not support legacy synax it seems. I' going to offer you another answer with latest syntax then.
–
HuygensJul 19 '12 at 13:31