The startup of services is controlled via the start command, which actually is a symbolic link to the initctl - please check the man for details.
I decided to check also if the number of respawns functionality really works - for that purpose I prepared a configuration file as below:
root@krystianek:/etc/init.d# cat /etc/init/test_respawn.conf
description "Test respawn"
start on filesystem or runlevel [2345]
stop on runlevel [!2345]
respawn
respawn limit 10 5
umask 022
pre-start script
end script
exec /etc/init.d/test_respawn.sh
root@krystianek:/etc/init.d#
root@krystianek:/etc/init.d# cat /etc/init.d/test_respawn.sh
#!/bin/sh
declare -i VALUE
echo "Testing respawn feature"
TMP_FILE=/tmp/count
if [ -f "$TMP_FILE" ]; then
VALUE=`cat ${TMP_FILE}`
else
VALUE=0
fi
VALUE=`expr $VALUE + 1`
echo $VALUE > ${TMP_FILE}
exit 1
The result shall be stored in the /tmp/count file. Now as everything is ready for the test it is time to do it:
root@krystianek:/etc/init.d# file /tmp/count
/tmp/count: ERROR: cannot open `/tmp/count' (No such file or directory)
root@krystianek:/etc/init.d# start test_respawn
test_respawn start/pre-start, process 8293
root@krystianek:/etc/init.d# cat /tmp/count
11
Voila the result is 11 (1 start attempt + 10 respawns).
Brak komentarzy:
Prześlij komentarz