-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathonoff
More file actions
executable file
·40 lines (38 loc) · 817 Bytes
/
onoff
File metadata and controls
executable file
·40 lines (38 loc) · 817 Bytes
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
#!/usr/bin/bash
#
# Name: /usr/sbin/onoff
#
# This script makes the functionality removed by systemd 258~rc1-1,
# init 0 to init 6, available again to the user in a running system.
if [ $# -ne 1 ]; then
echo "Only one option is permitted." && exit 1
fi
case "${1}" in
-h|--help)
echo "This script makes the functionality removed by systemd 258~rc1-1,"
echo "init 0 to init 6, available again to the user in a running system."
echo "Only one digit between 0 and 6 is permitted as an option."
;;
0)
systemctl poweroff
;;
1)
systemctl isolate emergency.target
;;
2)
systemctl isolate rescue.target
;;
3|4)
systemctl isolate multi-user.target
;;
5)
systemctl isolate graphical.target
;;
6)
systemctl reboot
;;
*)
echo "Error: >${1}< is not a valid option" && exit 1
;;
esac
exit 0