You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
waitfor(1) waits for an unrelated process using pidfd_open(2) on
Linux, kqueue(2) on OpenBSD, FreeBSD, stat(2) and usleep(3)
in a loop on Solaris, kill(2) and usleep in a loop for rest. It
waits for the process to terminate before it exits with 0 return status.
If there is an error waiting for the process, it exits 1. It can be used
in supervise(8) run script to monitor a process started outside
supervise, restarting it if needed. This can be important if the
manually started application cannot be terminated if the downtime has a
cost to business.
This example below starts up jboss under supervise after a clueless
application support person starts up jboss manually using the nohup
command.
#!/bin/sh
#
# supervise run script for jboss
#
exec 2>&1
# wait for manually started jboss application to terminate
pid=$(pgrep -f "java.*standalone.sh")
[ -n "$pid" ] && waitfor $pid
[ -x /usr/bin/svalert ] && /usr/bin/svalert "$@"
echo "Starting jboss"
exec setuidgid -es jboss /opt/jboss/bin/standalone.sh -b 0.0.0.0