I have a service I start/stop on boot/shutdown which I'm using to help me keep track of what I'm doing while experimenting with distributions on my RPi and swapping SD cards all the time.
The problem is that I put this on my new xbian image and I only get shutdown notifications.
Everything works fine on my main Raspbian which I've customized a lot. What I'm thinking is that the base xbian doesn't do very much yet, and my Raspbian has a lot of things running now after customization like samba, so the service starts much later on my fully developed raspbian than on xbian.
So what is the correct way to ensure this script runs only once the network connection is fully up?
Here is my script:
#! /bin/sh
# /etc/init.d/boot-notify
#
### BEGIN INIT INFO
# Provides: boot-notify
# Required-Start: $remote_fs $syslog $network $all
# Required-Stop: $remote_fs $syslog
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: Start daemon at boot time
# Description: Enable service provided by daemon.
### END INIT INFO
# Some things that run always
OS=$(uname -nr)
# Carry out specific functions when asked to by the system
case "$1" in
start)
echo "Starting script boot-notify "
curl -s -k \
-F "token=token" \
-F "user=token" \
-F "message=Raspberry Pi ($OS) boot-notify starting" \
https://api.pushover.net/1/messages
;;
stop)
echo "Stopping script boot-notify "
curl -s -k \
-F "token=token" \
-F "user=token" \
-F "message=Raspberry Pi ($OS) boot-notify stopping" \
https://api.pushover.net/1/messages
;;
*)
echo "Usage: /etc/init.d/boot-notify {start|stop}"
exit 1
;;
esac
exit 0
I seemed to be unable to capture the curl errors (removing -s and adding -v and >> to a log file and trying the -o option), but I added the following arguments to the startup and I'm getting boot notifications now:
--retry 10 \
--retry-delay 5 \
--retry-max-time 60 \
update-rc.dorinsserv? – Alex Chamberlain Aug 22 '12 at 7:22