Skip to content

Commit

Permalink
stop
Browse files Browse the repository at this point in the history
  • Loading branch information
gregorgorjanc committed Nov 21, 2016
1 parent c1cb6e5 commit 2c941e9
Showing 1 changed file with 57 additions and 0 deletions.
57 changes: 57 additions & 0 deletions func_stop.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@

# STOP
#-------------------------------------------------------------------------------

# Shutdown the machine with simple command. Needs user confirmation and
# user privilege to shutdown command via 'sudo'.

# Usage: stop

# My-time-stamp: <2003-11-16 08:56:00 ggorjan>

stop()
{
local NAME YORN
NAME=stop
echo -e 'Are you sure to shutdown the machine (y/N)? \c'
read YORN
if [ $YORN == y ]; then
if [ -f ${HOME}/.onStop.sh ]; then
source ${HOME}/.onStop.sh
fi
echo
echo 'Gooing to sleep .... bz ... :)'
echo
sudo shutdown -h now
else
echo 'OK, some other time.'
fi
}
export -f stop

# REBOOT
#-------------------------------------------------------------------------------

# Reboot the machine with simple command via 'sudo'. Needs user
# confirmation.

# Usage: reboot

# My-time-stamp: <2003-11-16 08:56:00 ggorjan>

reboot()
{
local NAME YORN
NAME=reboot
echo -e 'Are you sure to reboot the machine (y/N)? \c'
read YORN
if [ $YORN == y ]; then
echo
echo 'Rebooting ...'
echo
sudo /sbin/reboot
else
echo 'OK, some other time.'
fi
}
export -f reboot

0 comments on commit 2c941e9

Please sign in to comment.