Repository navigation
Expand file tree
/
Copy pathscstop
More file actions
executable file
·89 lines (77 loc) · 1.76 KB
/
Copy pathscstop
File metadata and controls
executable file
·89 lines (77 loc) · 1.76 KB
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
80
81
82
83
84
85
86
87
88
89
#!/bin/sh
################################################################################
#
# scstop
#
# Stop multiple systemd units and immediately follow journal of the last one
# using journalctl. Support starting 10 systemd units at once.
#
# Usage:
# ./scstop <service1> [service2] [service3] ... [service10]
#
# Example:
# ./scstop apache2 nginx
# This will stop apache2, nginx, then follow nginx logs.
#
# MIT License.
# Copyright (C) 2025 Nguyen Nhat Tung.
#
################################################################################
if [ ! -z "${1}" ]; then
systemctl stop ${1}
fi
if [ ! -z "${2}" ]; then
systemctl stop ${2}
else
journalctl --output cat --follow --no-hostname --unit ${1}
return 0
fi
if [ ! -z "${3}" ]; then
systemctl stop ${3}
else
journalctl --output cat --follow --no-hostname --unit ${2}
return 0
fi
if [ ! -z "${4}" ]; then
systemctl stop ${4}
else
journalctl --output cat --follow --no-hostname --unit ${3}
return 0
fi
if [ ! -z "${5}" ]; then
systemctl stop ${5}
else
journalctl --output cat --follow --no-hostname --unit ${4}
return 0
fi
if [ ! -z "${6}" ]; then
systemctl stop ${6}
else
journalctl --output cat --follow --no-hostname --unit ${5}
return 0
fi
if [ ! -z "${7}" ]; then
systemctl stop ${7}
else
journalctl --output cat --follow --no-hostname --unit ${6}
return 0
fi
if [ ! -z "${8}" ]; then
systemctl stop ${8}
else
journalctl --output cat --follow --no-hostname --unit ${7}
return 0
fi
if [ ! -z "${9}" ]; then
systemctl stop ${9}
else
journalctl --output cat --follow --no-hostname --unit ${8}
return 0
fi
if [ ! -z "${10}" ]; then
systemctl stop ${10}
else
journalctl --output cat --follow --no-hostname --unit ${9}
return 0
fi
journalctl --output cat --follow --no-hostname --unit ${10}