Skip to content

Instantly share code, notes, and snippets.

@fapestniegd
Created May 28, 2013 14:03
Show Gist options
  • Save fapestniegd/5662973 to your computer and use it in GitHub Desktop.
Save fapestniegd/5662973 to your computer and use it in GitHub Desktop.
#!/bin/bash
COUNT=0
while [ 1 ] ;do
ps -ef | grep sl[Aa]pd-$(hostname -s).pid
if [ $? -ne 0 ]; then
COUNT=$(expr ${COUNT} + 1)
echo "restart count: $COUNT"
cp -r /var/log/dirsrv/ /var/log/dirsrv.${COUNT}
find /var/log/dirsrv/ -type f -exec rm {} \;
/etc/init.d/dirsrv restart
fi
sleep 1
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment