nginx_daemon.sh
#!/bin/bash
#
this_pid=$$
while true
do
ps -ef | grep nginx | grep -v grep | grep -v $ this_pid &> /dev/null
if [$? -eq 0 ];then
echo " nginx is ok"
sleep 3
else
systemctl start nginx
echo "nginx is down,starting it..."
fi
done
Execute script
Background Execute the script and output the log to /tmp/nginx_daemon.out
sh nginx_daemon.sh> /tmp/nginx_daemon. out 2>&1 &
(sh nginx_daemon.sh & If you do not specify a file, it is in the nohup.out file of the current directory)
View log
tail -f /tmp/nginx_daemon.out
View task
View tasks.
jobs
Close task
fg %n
#!/bin/bash
#
this_pid=$$
while true
do
ps -ef | grep nginx | grep -v grep | grep -v $ this_pid &> /dev/null
if [$? -eq 0 ];then
echo " nginx is ok"
sleep 3
else
systemctl start nginx
echo "nginx is down,starting it..."
fi
done
Execute the script in the background and output the log to /tmp/nginx_daemon.out
sh nginx_daemon.sh> /tmp/nginx_daemon. out 2>&1 &
(sh nginx_daemon.sh & If you do not specify a file, it is in the nohup.out file of the current directory)
View log
tail -f /tmp/nginx_daemon.out
View tasks.
jobs
Close task
fg %n
WordPress database error: [Table 'yf99682.wp_s6mz6tyggq_comments' doesn't exist]
SELECT SQL_CALC_FOUND_ROWS wp_s6mz6tyggq_comments.comment_ID FROM wp_s6mz6tyggq_comments WHERE ( comment_approved = '1' ) AND comment_post_ID = 5520 ORDER BY wp_s6mz6tyggq_comments.comment_date_gmt ASC, wp_s6mz6tyggq_comments.comment_ID ASC