-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathstop_ser.sh
35 lines (26 loc) · 812 Bytes
/
stop_ser.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
#!/bin/bash
service=firewalld
STATUS=`systemctl is-active $service`
for x in 1 1 1 1 1; do
while [[ $STATUS = 'active' || $STATUS = 'inactive' ]]; do
echo "Service is $STATUS"
if [ $STATUS = 'active' ];
then
`sudo systemctl stop $service`
echo "We are stopping Service of $service"
echo "$service has stopped"
`sleep 5`
break
elif [ $STATUS = 'inactive' ];
then
`sudo systemctl start $service`
echo "$service has started"
`sleep 5`
echo "This is the status ($STATUS) of $service Service"
break
else
#break
echo "$service already stopped"
fi
done
done