crontab and running state not working

Support and queries relating to all previous versions of ZoneMinder
Locked
ynn
Posts: 152
Joined: Fri Mar 17, 2006 2:30 am

crontab and running state not working

Post by ynn »

I have created crontab and running state called Morning and Night
crontab -l
10 6 * * * root /usr/local/bin/zmpkg.pl Morning
10 20 * * * root /usr/local/bin/zmpkg.pl Night
crond is running and cron.allow is already created

but the running state is not changed after the time passed.
do i need to run or create anything else to make cron working?

thanks.
User avatar
voronwe
Posts: 193
Joined: Tue Jan 18, 2005 12:40 am
Location: Copenhagen Denmark

Post by voronwe »

Hi ynn

If my memory serves me right then what you need to change is the following. :

Code: Select all

10 6 * * * root /usr/local/bin/zmpkg.pl 'Morning'

10 20 * * * root /usr/local/bin/zmpkg.pl 'Night'
The changes are the little ' surrounding the state name.
Best Regards
Tom Stage
Flash_
Posts: 441
Joined: Wed Jan 11, 2006 12:19 pm

Post by Flash_ »

Shouldn't need the quotes - but the state IS case-sensitive.

Also I never specified a user, but that shouldn't be the problem.

Does it work when you run zmpkg.pl from the command line to switch states?
ynn
Posts: 152
Joined: Fri Mar 17, 2006 2:30 am

Post by ynn »

Yeah I just got it worked out with these:
10 7 * * * /usr/bin/sudo -u apache /usr/local/bin/zmpkg.pl Morning >> /root/logfile.txt 2>&1
10 17 * * * /usr/bin/sudo -u apache /usr/local/bin/zmpkg.pl Night >> /root/logfile.txt 2>&1

Thanks.
Flash_
Posts: 441
Joined: Wed Jan 11, 2006 12:19 pm

Post by Flash_ »

Ahh, sudo. Ubuntu by chance? :)
ynn
Posts: 152
Joined: Fri Mar 17, 2006 2:30 am

Post by ynn »

been using Centos4.3, have never been using ubuntu. is it better than fedora ?
Flash_
Posts: 441
Joined: Wed Jan 11, 2006 12:19 pm

Post by Flash_ »

Ah, sorry. The sudo thing is something that marks Ubuntu out as different in usage to many other distros, i didn't know Centos used sudo too.

Glad you got it sorted out.
User avatar
cordel
Posts: 5210
Joined: Fri Mar 05, 2004 4:47 pm
Location: /USA/Washington/Seattle

Post by cordel »

Actually sudo in in most distro's or I should say that I know it is in Mandriva/Mandrake, Suse, Fedora/RedHat/CentOS, Debian, and Ubuntu. It's part of the common command set for Linux.

Regards,
Corey
Flash_
Posts: 441
Joined: Wed Jan 11, 2006 12:19 pm

Post by Flash_ »

In most distros, but not installed by default (certainly not Debian).

My reason for mentioning Ubuntu is because that uses only sudo, not su at all - and it's a common problem that crops up in many web forums for people coming from other distros to it. This would've applied to crontab as in most distros you'd use root's crontab, or zmuser's crontab to invoke zmpkg.pl to change states, and using root's crontab doesn't work with ubuntu (afaik) simply because it doesn't have a root account.

But, as you can see, I was wrong. :)
Locked