Hello Eric, you can not use scripts are running in an infinite loop. The script must spawn or you wrapper script should do this.
> I have a (legacy) shell script that I need to call from monit. This shell > script runs an infinite loop. A good source are the scripts used with systemd or initd. Unfortunalely, there is no general way to create an useful script, but the script should not quit immediately. To start Jetty I use something like the following, without any sleep. case "$1" in 'start') cd "${DIR}/jetty" $PRG status if [ $? -ne $ONLINE ]; then # export TZ=Europe/Berlin export TZ=MEZ-1MESZ,M3.5.0,M10.5.0 export PATH=${DIR}/Java/jre8/bin:$PATH export JAVA_HOME=${DIR}/Java/jre8 # export JETTY_BASE=${DIR}/jetty export JETTY_HOME=${DIR}/jetty nohup java -jar $JETTY_HOME/start.jar >> $LOGFILE 2>&1 & echo $! > $PIDFILE fi RC=0 ;; But for some scripts are spawning itself I use a sleep too for some other not. The answer to your problem, it depends. Sorry, with regards, Lutz