Small changes
This commit is contained in:
parent
9e52f24654
commit
73e0059139
|
@ -21,9 +21,10 @@ if ( [ -z $servicestate ] || [ -z $servicestatetype ] || [ -z $serviceattempt ]
|
|||
echo "USAGE: $0 -s servicestate -z servicestatetype -a serviceattempt -S service"
|
||||
exit 3;
|
||||
else
|
||||
# Only restart on the third attempt of a critical event
|
||||
if ( [ $servicestate == "CRITICAL" ] && [ $servicestatetype == "SOFT" ] && [ $serviceattempt -eq 3 ] ); then
|
||||
if [ pidof systemd >/dev/null ]; then
|
||||
# Only restart on the third attempt of a critical event in soft state and in first attempt of a critical event in hard state
|
||||
if [ $servicestate == "CRITICAL" ] && ( ( [ $serviceattempt -eq 3 ] && [ $servicestatetype == "SOFT" ] ) || ( [ $serviceattempt -eq 1 ] && [ $servicestatetype == "HARD" ] ) ); then
|
||||
pidof systemd >/dev/null
|
||||
if [ $? -eq 0 ]; then
|
||||
sudo systemctl restart $service
|
||||
else
|
||||
sudo service $service restart
|
||||
|
|
Loading…
Reference in New Issue