-
Notifications
You must be signed in to change notification settings - Fork 8
/
Copy path.systemd.sh
79 lines (74 loc) · 1.57 KB
/
.systemd.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
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
# vim: ft=sh sw=2 ts=2 sts=2
# simplified systemd command, for instance
# "sudo systemctl stop xxx" - > "0.stop xxx"
if ! cmd-exists systemd-notify || ! systemd-notify --booted;
then # for not systemd
0.start() {
sudo rc.d start "$@"
}
0.restart() {
sudo rc.d restart "$@"
}
0.stop() {
sudo rc.d stop "$@"
}
else
0.reboot() {
systemctl reboot "$@"
}
0.off() {
systemctl poweroff "$@"
}
# start systemd service
0.start() {
sudo systemctl start "$@"
}
# restart systemd service
0.restart() {
sudo systemctl restart "$@"
}
# stop systemd service
0.stop() {
sudo systemctl stop "$@"
}
# enable systemd service
0.enable() {
sudo systemctl enable "$@"
}
# disable a systemd service
0.disable() {
sudo systemctl disable "$@"
}
# show the status of a service
0.status() {
systemctl status "$@"
}
# reload a service configuration
0.reload() {
sudo systemctl --system daemon-reload
}
# list all running service
0.list() {
systemctl
}
# list all failed service
0.failed () {
systemctl --failed
}
# list all systemd available unit files
0.list-files() {
systemctl list-unit-files
}
# check the log
0.log() {
sudo journalctl --follow --this-boot "$@"
}
# show wants
0.wants() {
systemctl show -p "Wants" $1.target
}
# analyze the system
0.analyze() {
systemd-analyze "$@"
}
fi