Skip to content

Instantly share code, notes, and snippets.

@dongyuwei
Created January 1, 2015 13:53
Show Gist options
  • Save dongyuwei/2739c809efce7d7ec80a to your computer and use it in GitHub Desktop.
Save dongyuwei/2739c809efce7d7ec80a to your computer and use it in GitHub Desktop.
cron job for nginx server
#crontab -u root -e
# m h dom mon dow command
#*/1 * * * * /bin/sh /opt/code/cron.sh > /dev/null 2>&1
count=`ps -wef|grep sbin/nginx |grep -v grep |wc -l`
if [ "$count" -eq 1 ]; then
echo "The nginx process already run";
else
echo "Start the nginx process now:"
/usr/local/nginx/sbin/nginx -c /usr/local/nginx/conf/nginx.conf
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment