#!/bin/sh
### BEGIN INIT INFO
# Provides:						safe_message
# Required-Start:
# Required-Stop:			halt
# X-Stop_after:				 $local_fs umountroot
# Default-Start:
# Default-Stop:				0
# Short-Description:	Safe to power off clock message
### END INIT INFO

case "$1" in
  start)
    ;;
  stop)
		echo Calling Sendchild
#TIMECLOCK 		/usr/local/bin/sendchild "Clock Stopping" "" "" ""
#JOBCLOCK 		/usr/local/bin/sendchild -l 16 "Clock Stopping" "" "" ""
		/usr/local/bin/sendchild "Clock Stopping" "" "" ""
		# then sendchild is called as a background process, with a delay of 20 seconds.
#TIMECLOCK 		/usr/local/bin/sendchild -d 20 "Clock Stopped." "It is now safe to" "power off the clock." "" &
#JOBCLOCK 		/usr/local/bin/sendchild -d 20 -l 16 "It is safe to" "power off clock." "" "" &
		/usr/local/bin/sendchild -d 20 "Clock Stopped." "It is now safe to" "power off the clock." "" &
		echo Called Sendchild
# XXX Temporarily disabling battery control pins
#		echo Turning Battery Off
#		echo 0 > /sys/class/gpio/pioB0/value
    ;;
  *)
    echo "Usage: /etc/init.d/safe-message {start|stop}"
    exit 1
    ;;
esac

exit 0
