On Thu, 19 Oct 2006, Chris Purves wrote:
I'm running sa-update from a bash script in /etc/cron.hourly but I keep
getting the following every time the script runs:

run-parts: /etc/cron.hourly/sa-update exited with return code 1

I believe this is because sa-update only returns error code 0 when something
has been updated so that you can append && restart spamd command.

The documentation says 1 means it successfully checked,
but there was no new data.  0 means it found new data and
successfully downloaded it.  Since 1 is an OK exit code that
doesn't present a problem, you could do this:

    sa-update || true

"true" is a program that exits with a code of 0.

Then again, presumably /etc/cron.hourly/sa-update is a script,
not a symlink to /usr/bin/sa-update or something, so you could
just add "exit 0" as the last line of the script.  If you just
have sa-update in it alone, the script will exit with the code
that sa-update exits with.

If you want to get really fancy and ignore 1 but not
ignore other non-zero exit codes, you can use this as your
/etc/cron.hourly/sa-update script:

        #! /bin/sh

        # run and immediately capture exit code
        sa-update
        rc=$?

        case "$rc" in
        0|1)
            rc=0
            ;;
        esac

        exit "$rc"

Hope that helps.

  - Logan

Reply via email to