[SOLVED]1.30.4: Cron doesn't change state (no error)

Forum for questions and support relating to the 1.30.x releases only.
Locked
effe
Posts: 16
Joined: Mon Jul 20, 2015 8:28 pm

[SOLVED]1.30.4: Cron doesn't change state (no error)

Post by effe »

AS subject.
Ubuntu 16.04, zmpkg.pl is on /usr/bin/.
From terminal I can change the state with on issue at all with

Code: Select all

sudo usr/bin/zmpkg.pl Closed
But I can't with Cron.
After reading the FAQ I added with crontab -e the fellowing lines:

Code: Select all

01 7 * * 1-6 root /usr/bin/zmpkg.pl Open
01 22 * * 1-5 root /usr/bin/zmpkg.pl Closed
31 15 * * 6 root /usr/bin/zmpkg.pl Closed
I tried with my user, with www-data and without user and I have no path error but just an output error with another pid in syslog:

Code: Select all

effe@DivinaCameras:~$ tail -f /var/log/syslog | grep CRON
Sep  8 11:11:01 DivinaCameras CRON[3547]: (effe) CMD (/usr/bin/zmpkg.pl Closed)
Sep  8 11:11:01 DivinaCameras CRON[3546]: (CRON) info (No MTA installed, discarding output)
Sep  8 11:13:01 DivinaCameras CRON[3587]: (effe) CMD (www-data /usr/bin/zmpkg.pl Closed)
Sep  8 11:13:01 DivinaCameras CRON[3586]: (CRON) info (No MTA installed, discarding output)
Sep  8 11:15:01 DivinaCameras CRON[3636]: (effe) CMD (root /usr/bin/zmpkg.pl Closed)
Sep  8 11:15:01 DivinaCameras CRON[3635]: (CRON) info (No MTA installed, discarding output)
Sep  8 11:34:01 DivinaCameras CRON[3928]: (effe) CMD (effe /usr/bin/zmpkg.pl Closed)
Sep  8 11:34:01 DivinaCameras CRON[3927]: (CRON) info (No MTA installed, discarding output)
Where I'm wrong?

Thanks,

F.
Last edited by effe on Mon Sep 11, 2017 8:45 pm, edited 2 times in total.
mikb
Posts: 600
Joined: Mon Mar 25, 2013 12:34 pm

Re: 1.30.4: Cron doesn't change state (no error)

Post by mikb »

Doesn't look like an error at all :- "info ..." is an informational message. It's saying (I think) that cron tried to email the result of executing the command, and failed, because you don't have an MTA installed.

The output of commands in cron are usually mailed to the user that appears to be running the command.

Also: "Another PID" is also not a problem: an instance of "cron" has started, and the next process started was your job to change state. So the next PID along.

More importantly, does it actually change state, despite these informational warnings?
effe
Posts: 16
Joined: Mon Jul 20, 2015 8:28 pm

Re: 1.30.4: Cron doesn't change state (no error)

Post by effe »

Nope. I can change via terminal with or without a full path, but doesn't change with Cron.
User avatar
knight-of-ni
Posts: 2404
Joined: Thu Oct 18, 2007 1:55 pm
Location: Shiloh, IL

Re: 1.30.4: Cron doesn't change state (no error)

Post by knight-of-ni »

Until we can see the output, we are just guessing what the problem might be.

Fix the missing the MTA part
https://askubuntu.com/questions/222512/ ... the-syslog

Then check root's local email and post the output
Visit my blog for ZoneMinder related projects using the Raspberry Pi, Orange Pi, Odroid, and the ESP8266
All of these can be found at https://zoneminder.blogspot.com/
bbunge
Posts: 2934
Joined: Mon Mar 26, 2012 11:40 am
Location: Pennsylvania

Re: 1.30.4: Cron doesn't change state (no error)

Post by bbunge »

If i remember you should use www-data not root.

I used Webmin to set up a cron job to change state of Zoneminder. Worked quite well and I did not have to guess at the command line settings!
effe
Posts: 16
Joined: Mon Jul 20, 2015 8:28 pm

Re: 1.30.4: Cron doesn't change state (no error)

Post by effe »

---------------------------------------------------------------------------------
EDIT: Soved configuring crontab as root (with sudo -i) without specify user at all.

Code: Select all

01 7 * * 1-6 root /usr/bin/zmpkg.pl Open
Don't ask me why...
---------------------------------------------------------------------------------
knnniggett wrote: Sat Sep 09, 2017 1:05 pm Then check root's local email and post the output
for every mail It shows

Code: Select all

/bin/sh: root: not found
Same thing with my user and with www-data
Here's a complete email sent:

Code: Select all

From effe@DivinaCameras  Mon Sep 11 17:17:01 2017
Return-Path: <effe@DivinaCameras>
X-Original-To: effe
Delivered-To: effe@DivinaCameras
Received: by DivinaCameras (Postfix, from userid 1000)
        id 5A37B46009E; Mon, 11 Sep 2017 17:17:01 -0300 (BRT)
From: root@DivinaCameras (Cron Daemon)
To: effe@DivinaCameras
Subject: Cron <effe@DivinaCameras> root /usr/bin/zmpkg.pl Closed
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
X-Cron-Env: <SHELL=/bin/sh>
X-Cron-Env: <HOME=/home/effe>
X-Cron-Env: <PATH=/usr/bin:/bin>
X-Cron-Env: <LOGNAME=effe>
Message-Id: <20170911201701.5A37B46009E@DivinaCameras>
Date: Mon, 11 Sep 2017 17:17:01 -0300 (BRT)

/bin/sh: 1: root: not found
I've tested on both user and root crontab. In the second case I have no mail output at all for root.
bbunge wrote: Sat Sep 09, 2017 2:06 pm If i remember you should use www-data not root.
tested with user, root, or www-data with no luck.
I used Webmin to set up a cron job to change state of Zoneminder. Worked quite well and I did not have to guess at the command line settings!
Then check root's local email and post the output
I'll have a look on it. But why install more package for something that should be working out of the box?
Locked