How to conform to update-rc.d with LSB standard?
- by user34881
This is a migrated question from stackoverflow, as I was told, this is the place for it to be.
http://stackoverflow.com/questions/2263567/how-to-conform-to-update-rc-d-with-lsb-standard
I have set up a simple script to back up some directories. While I haven't had any problems setting up the functionality, I'm stuck with adding the script to rcX.d dir's using update-rc.d.
My script:
#! /bin/sh
### BEGIN INIT INFO
# Provides: backup
# Required-Start: backup
# Required-Stop:
# Should-Stop:
# Default-Start: 0 6
# Default-Stop:
# Description: Backs up some dirs
### END INIT INFO
check_mounted() {
# Check if HD is mounted
}
do_backup() {
if check_mounted; then
# Some rsync statements.
fi
}
case "$1" in
start)
do_backup
;;
restart|reload|force-reload)
echo "Error: argument '$1' not supported" >&2
exit 3
;;
stop|"")
# No-op
;;
*)
echo "Usage: backup [start]" >&2
exit 3
;;
esac
:
Using update-rc.d backup start 10 0 6 . I get the following warnings and errors:
update-rc.d: warning: backup start runlevel arguments (none) do not match LSB Default-Start values (0 6)
update-rc.d: warning: backup stop runlevel arguments (0 6.) do not match LSB Default-Stop values (none)
update-rc.d: error: start|stop arguments not terminated by "."
The syntax I try to use is the following:
update-rc.d [-n] <basename> start|stop NN runlvl [runlvl] [...] .
Google wasn't that helpful at finding a solution. How can I correctly set up a script and add it via update-rc.d?
I'm using Ubuntu 9.10.
UPDATE
Using update-rc.d backup start 10 0 6 . stop 10 0 . the error disappears.
The warnings about default values persists:
update-rc.d: warning: backup start runlevel arguments (none) do not match LSB Default-Start values (0 6)
update-rc.d: warning: backup stop runlevel arguments (0 6 0 6) do not match LSB Default-Stop values (none)
It even is added to the appropiate rcX-dirs but it still does not get executed...