Home Forums OS X Server and Client Discussion Questions and Answers crontab and exit status interpretation

Viewing 1 post (of 1 total)
  • Author
    Posts
  • #367868
    tk421
    Participant

    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!

Viewing 1 post (of 1 total)
  • You must be logged in to reply to this topic.

Comments are closed