Re: cron job to restart process if dead
Dunno, but here's what I'd try:
#!/bin/bash
# If you don't have /sbin/pidof linked to /sbin/killall5:
# Mimic pidof's "-s" using head -n 1, after all we don't expect multiple snorts running
PID=$(/bin/ps ax | grep snort | grep -v grep | awk {'print $1'} | head -n 1)
# else
# PID=$(/sbin/pidof -s /usr/bin/snort)
if [ "$PID" = "" ]; then <remove-stale-pid command>; <restart command>; fi
Last edited by unSpawn; 09-25-2002 at 07:02 AM.
|