File tree Expand file tree Collapse file tree 2 files changed +10
-13
lines changed Expand file tree Collapse file tree 2 files changed +10
-13
lines changed Original file line number Diff line number Diff line change 1
1
function start_service {
2
- if [ " $( systemctl is-active " $1 " 2> " $LOGFILE " ) " = " inactive" ]
3
- then
4
- systemctl start " $1 " > " $LOGFILE " 2> " $LOGFILE "
2
+ if [ " $( systemctl is-active " $1 " 2> " $LOGFILE " ) " = " inactive" ]; then
3
+ systemctl start " $1 " > " $LOGFILE " 2> " $LOGFILE " || log_and_exit1 " Failed to start service $1 "
5
4
fi
6
5
}
7
6
8
7
function restart_service {
9
- systemctl stop " $1 " > " $LOGFILE " 2> " $LOGFILE "
10
- systemctl start " $1 " > " $LOGFILE " 2> " $LOGFILE "
8
+ systemctl stop " $1 " > " $LOGFILE " 2> " $LOGFILE " || log_and_exit1 " Failed to stop service $1 "
9
+ systemctl start " $1 " > " $LOGFILE " 2> " $LOGFILE " || log_and_exit1 " Failed to start service $1 "
11
10
}
12
11
13
12
function stop_service {
14
- if [ " $( systemctl is-active " $1 " 2> " $LOGFILE " ) " = " active" ]
15
- then
16
- systemctl stop " $1 " > " $LOGFILE " 2> " $LOGFILE "
13
+ if [ " $( systemctl is-active " $1 " 2> " $LOGFILE " ) " = " active" ]; then
14
+ systemctl stop " $1 " > " $LOGFILE " 2> " $LOGFILE " || log_and_exit1 " Failed to stop service $1 "
17
15
fi
18
16
}
19
17
20
18
function enable_service {
21
- if [ " $( systemctl is-enabled " $1 " 2> " $LOGFILE " ) " = " disabled" ]
22
- then
23
- systemctl enable " $1 " > " $LOGFILE " 2> " $LOGFILE "
19
+ if [ " $( systemctl is-enabled " $1 " 2> " $LOGFILE " ) " = " disabled" ]; then
20
+ systemctl enable " $1 " > " $LOGFILE " 2> " $LOGFILE " || log_and_exit1 " Failed to enable service $1 "
24
21
fi
25
22
}
26
23
27
24
function disable_service {
28
25
if [ " $( systemctl is-enabled " $1 " 2> " $LOGFILE " ) " = " enabled" ]; then
29
- systemctl disable " $1 " > " $LOGFILE " 2> " $LOGFILE "
26
+ systemctl disable " $1 " > " $LOGFILE " 2> " $LOGFILE " || log_and_exit1 " Failed to disable service $1 "
30
27
fi
31
28
}
32
29
Original file line number Diff line number Diff line change 1
1
{
2
2
"name" : " @treehouses/cli" ,
3
- "version" : " 1.25.20 " ,
3
+ "version" : " 1.25.21 " ,
4
4
"remote" : " 4000" ,
5
5
"description" : " Thin command-line interface for Raspberry Pi low level configuration." ,
6
6
"main" : " cli.sh" ,
You can’t perform that action at this time.
0 commit comments