crontab is not working

Brandon J. Wandersee brandon.wandersee at
Sat Mar 5 21:23:04 UTC 2016

gahn via freebsd-questions writes:

> hi:
> i am trying to test a crontab job for snmpwalk but it is not working:
> here is crontab:
> */1  * * * * root /root/
> for the script, it is very simple:
> #!/usr/local/bin/bash
> /usr/local/bin/snmpwalk -v 2c -c public
> from the log, i can see this
> Mar 4 15:22:00 snails /usr/sbin/cron[88515]: (operator) CMD (/usr/libexec/save-entropy)
> Mar 4 15:22:00 snails /usr/sbin/cron[88516]: (root) CMD (root^I/root/
> Mar 4 15:23:00 snails /usr/sbin/cron[88531]: (root) CMD (root^I/root/
> Mar 4 15:24:00 snails /usr/sbin/cron[88534]: (root) CMD (root^I/root/
> thanks.

This is a very minor nitpick, and unlikely to be the cause of the
problem, but there's nothing in that script that requires Bash. Use
`#!/bin/sh` instead. It's the default execution shell for the system. In
fact, since you specify the full path to snmpwalk in the script you
could remove the shebang altogether and just run `sh /root/`
in the cron job.

Though it's probably not the solution (I assume you have Bash
installed), using the native shell rather than a third-party shell would
at least rule out a possible cause.

   		      :: Brandon Wandersee ::
                  :: brandon.wandersee at ::

More information about the freebsd-questions mailing list