AFP548

crontab and exit status interpretation

I've got a script that checks to make sure that cupsd is running and if it's not to start it up again: #!/bin/sh /bin/ps -aux | /usr/bin/grep cupsd | /usr/bin/grep -v grep if [ $? = 0 ]; then : else /sbin/SystemStarter start PrintingServices fi When I test this from a shell session it works perfectly (if cups is running the exit status is 0). When I add it to root's crontab the script runs as if the exit status was 1 no matter what. Cron seems to be getting confused about the exit status. Any idea why? root's crontab: 0-59/5 5-23 * * 1-5 /var/root/cups_heartbeat.sh thanks a bunch!
Exit mobile version