I have created a Init.d like:
#!/bin/sh /etc/rc.common
# Example script
# Copyright (C) 2007 OpenWrt.org
START=99
start() {
echo start
/usr/bin/php-cli -f /path-to-php-script
}
stop() {
echo stop
kill -9 $(pgrep -f NameOfPhpScript)
}
restart() {
echo restart
kill -9 $(pgrep -f NameOfPhpScript)
/usr/bin/php-cli -f /path-to-php-script
}
So far, so good the service starts up the script (which runs continious in the background).
But sometimes the Script (and the Process) dies and does not start again automatically.
So i thougt about a respawning process in /etc/inittab instead of init.d like:
::respawn:/usr/bin/php-cli -f /path-to-php-script
It starts the process at boot time as expected but:
It's starting very early in the boot process so the script cannot succesfully execute.
And it doesn't restart if i kill the process.
So i would be very happy for a sugestion, what i can do here to implement this in a good way.
Hint: Im still a Linux dummy
Thanks!