forked from gregorgorjanc/GorjancShell
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathfunc_stop.sh
57 lines (47 loc) · 1.19 KB
/
func_stop.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
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