#! /bin/sh
# /etc/init.d/onofflog.sh

### BEGIN INIT INFO
# Provides:          Mohamed Soubhi
# Required-Start:    $remote_fs $syslog
# Required-Stop:     $remote_fs $syslog
# Default-Start:     2 3 4 5
# Default-Stop:      0 1 6
# Short-Description: Simple script to log power on and reboot and shut down
# Description:       A simple script from logging power on and pwoer of and reboot.
### END INIT INFO

# If you want a command to always run, put it here

# Carry out specific functions when asked to by the system
ONOFF_LOG=/var/www/onoff.log

case "$1" in
  start)
    echo "Power on Log"
    # run application you want to start

    bash /home/pi/ourscripts/poweron_script.sh


    ;;
  stop)
    echo "Shutdown Log"
    # kill application you want to stop
    
    bash /home/pi/ourscripts/shutdown_script.sh


    ;;
  *)
    echo "No Log"
    exit 1
    ;;
esac

exit 0