#!/bin/sh
While True
Do
PS | grep "MAIN_3G" | Grep-v "grep" >/dev/null
If ["$?"-ne 0]
Then
ls/root/main_3g >/dev/null
If ["$?"-eq 0]
Then
chmod 777/root/main_3g
/ROOT/MAIN_3G &
echo "main_3g Restart"
Else
echo "main_3g is not exist."
Fi
Fi
PS | grep "MAIN_4G" | Grep-v "grep" >/dev/null
If ["$?
"-ne 0]
Then
ls/root/main_4g >/dev/null
If ["$?"-eq 0]
Then
chmod 777/root/main_4g
/ROOT/MAIN_4G &
echo "main_4g Restart"
Else
echo "main_4g is not exist."
Fi
Fi
Sleep 5
Done
Add the above step command to the/etc/rc.d/rc.local, and add it later.
ls/root/mymonitor.sh >/dev/null
If ["$?
"-eq 0]
Then
chmod 777/root/mymonitor.sh
/root/mymonitor.sh &
echo "Run/root/mymonitor.sh"
Else
echo "/root/mymonitor.sh is not exist."
Fi
Copyright notice: This article blog original article. Blogs, without consent, may not be reproduced.
Linux script background monitoring executes the state of the specified program (assuming the program is a dead restart program)