Page 1 of 1

crontab and running state not working

Posted: Wed Jun 28, 2006 2:14 pm
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.

Posted: Wed Jun 28, 2006 10:30 pm
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.

Posted: Thu Jun 29, 2006 6:10 am
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?

Posted: Thu Jun 29, 2006 11:27 am
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.

Posted: Fri Jun 30, 2006 6:30 am
by Flash_
Ahh, sudo. Ubuntu by chance? :)

Posted: Sat Jul 01, 2006 6:18 am
by ynn
been using Centos4.3, have never been using ubuntu. is it better than fedora ?

Posted: Sat Jul 01, 2006 8:19 am
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.

Posted: Sat Jul 01, 2006 9:31 am
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

Posted: Sun Jul 02, 2006 7:27 am
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. :)