#!/usr/bin/env bash function start_nginx() { /usr/sbin/nginx -p /usr/local/jekyll/nginx -c nginx.conf } function watchtower() { while true; do ps -elf | grep nginx | grep -v grep | grep nginx >/dev/null 2>&1 RC=$? if [[ $RC != 0 ]]; then start_nginx fi sleep 10 done } watchtower