Issues with scripts that run fine when invoked manually from the command line but fail when run by cron almost always seem to come down to an issue with the $PATH in cron's environment.

Try removing the STDOUT redirect to /dev/null on the cronjob, and after it runs again, check /var/mail/root for the output of the cronjob (or just run `mail` as root).  Whatever error is thrown when running from within cron's environment should then be there.  Alternatively, you can change the redirect to point to /tmp/debugcron.txt or something and check that file for the output, as well.  You may have to redirect both STDERR and STDOUT to the file... e.g.:

*/5    *    *    *    *    root    /usr/local/www/observium/poller-wrapper.py 2 2>&1 >> /tmp/debugcron.txt

On 10/19/2016 11:28 AM, Simon Smith wrote:
Hi All,

this is a random question, has anyone got observium running correctly on freebsd?

managed to get it all setup and running, panels fine, add devices fine, poll device manually, etc

only issue I’m having is i can’t get the cronjob working for every 5mins?

i can see from the cron log in /var/log its running the poller correctly

Oct 18 04:05:00 observium /usr/sbin/cron[49554]: (root) CMD (/opt/observium/poller-wrapper.py 2 >> /dev/null)
Oct 18 04:10:00 observium /usr/sbin/cron[50385]: (root) CMD (/usr/libexec/atrun)
Oct 18 04:10:00 observium /usr/sbin/cron[50387]: (root) CMD (/opt/observium/poller-wrapper.py 2 >> /dev/null)
Oct 18 04:15:00 observium /usr/sbin/cron[51227]: (root) CMD (/usr/libexec/atrun)
Oct 18 04:15:00 observium /usr/sbin/cron[51228]: (root) CMD (/opt/observium/poller-wrapper.py 2 >> /dev/null)
Oct 18 04:20:00 observium /usr/sbin/cron[52076]: (root) CMD (/usr/libexec/atrun)
Oct 18 04:20:00 observium /usr/sbin/cron[52079]: (root) CMD (/opt/observium/poller-wrapper.py 2 >> /dev/null)
Oct 18 04:25:00 observium /usr/sbin/cron[52917]: (root) CMD (/usr/libexec/atrun)
Oct 18 04:25:00 observium /usr/sbin/cron[52918]: (root) CMD (/opt/observium/poller-wrapper.py 2 >> /dev/null)
Oct 18 04:30:00 observium /usr/sbin/cron[53752]: (root) CMD (/usr/libexec/atrun)
Oct 18 04:30:00 observium /usr/sbin/cron[53753]: (root) CMD (/opt/observium/poller-wrapper.py 2 >> /dev/null)

however no data gets inserted into the db, but if i run the command manually as root, it inserts stuff fine?

the only thing i can think of is the php is running apache which then runs as www not root

would this have an issue maybe?

regards

Simon 
_______________________________________________
observium mailing list
observium@observium.org
http://postman.memetic.org/cgi-bin/mailman/listinfo/observium