#-------------------------------------------------------------------------------
#  Howto setup the safe shutdown system daemon
#-------------------------------------------------------------------------------

#Enter home directory:
cd

#Download the daemon:
curl -O -J "https://www.carberry.it/index.php?route=download/download/download&download_id=31"

#Untar the file:
tar -xvf shutdown_d_1.1.tar

#Create directory in /usr/local/bin
sudo mkdir -p /usr/local/bin/carberry

#Move directory to /usr/local/bin/carberry
sudo mv shutdown_d /usr/local/bin/carberry/

#Add execution rights:
chmod +x /usr/local/bin/carberry/shutdown_d/shutdown.sh

#Add a new line to the /etc/rc.local before exit 0 line.
#Edit:
sudo nano /etc/rc.local

#Add:
/usr/local/bin/carberry/shutdown_d/shutdown.sh&
exit 0

#System Reboot
sudo reboot

#Check daemon execution:
ps aux | grep shutdown

#You have to see something like this:
pi@raspberrypi ~ $ ps aux | grep shutdown
root      2058  0.4  0.2   2736  1188 ?        S    14:40   0:00 /bin/bash /home/pi/shutdown_d/shutdown.sh
pi        2380  0.0  0.1   3568   832 pts/0    S+   14:42   0:00 grep --color=auto shutdown
pi@raspberrypi ~ $
