Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/bin/bash
- # Intended usage: add into cron job commands
- # Ex: . ~/.bashrc && $EG_BIN_DIR/run_cron && $EG_BIN_DIR/blah
- # This should hopefully stop "SERVICES AREN'T RUNNING!" error messages from being sent
- if [ -f "/openils/conf/stop_cron" ]; then
- # Intentionally stop cron jobs
- exit 1
- fi
- if [ "$(ls -1 /openils/var/run/opensrf/*.pid 2>/dev/null | wc -l)" -lt 20 ]; then
- # Not enough services apparently running
- exit 2
- fi
- for PID in $(cat /openils/var/run/opensrf/*.pid); do
- # Check all service PID files
- if ! ps -p $PID > /dev/null 2>&1; then
- # If a service's PID isn't active, bail
- exit 3
- fi
- done
- # Assume success if we reach this point
- exit 0
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement