PDA

View Full Version : [SOLVED] 11.04 (beta) CRON daemon



member1000
September 20th, 2011, 06:24 PM
I installed a vanilla 11.04 on a vserver, installed then bunch of services (apache, mysql5, php, vsfrpd, rsync etc.), blocked ssh access to root, all within minutes. All perfectly working. Cool.

So ...
ps-edaf|grep cron ... whereīs CRON?
sudo start cron ... result: start/running
sudo start cron ... result: start: Job is already running: cron ... well, sounds OK
ps -edaf|grep cron ... result: cron not existent
Additionally in syslog thereīs no a single DOT about the manipulation with cron

In 10.04 ... I can start/stop cron as expected, I see the daemon wirh ps-edaf|grep cron when running and syslog carries all the approp. messages.

Did change something significantly in 11.04 with respect to cron?
Or did I overlook something essential here?

Any help very appreciated as I donīt like to revert to 10.04 (when I donīt have to)

Tks for reading, Tony

papibe
September 21st, 2011, 12:10 AM
I'm running a 11.04 test server. Cron runs as expected here. It could be interesting to "force" the cron process to do something.

For example a simple log that runs every minute:

$ crontab -e
And something like this would work as a test:

*/1 * * * * /bin/date >> /home/youruser/cron.log
Then after a couple of minutes you should see if it's working:

$ more cron.log
Tue Sep 20 18:04:01 CDT 2011
Tue Sep 20 18:05:01 CDT 2011
Also you can check the syslog:

$ tail /var/log/syslog
or

$ grep -i cron /var/log/syslog | tail
Note the -i option for grep since cron logs its entries as 'CRON'.

Tell us how it goes,
Regards.

member1000
September 21st, 2011, 12:54 AM
Well you just assume cron deamon is working ... the case is, itīs not working as I can simply check by ps -edaf|grep cron ... inīs NOT there. My question is ... WHY is it not there. I can start cron but nothing happens. When I start it second time I get the message ... itīs already running ... BUT ... IT IS NOT running, it is just not in the prosess list. When the cron daemon IS running the crontab entries will be serviced as can be assumed.

cron daemon is NOT running, why, thatś the point.

Tony

dave01945
September 21st, 2011, 01:14 AM
i don't think papibe was assuming cron was running he/she was giving you advice on how to check if it actually is running which will help to figure out what is happening

also it is my understanding that you will not have cron running until you have created a crontab for the user only anacron will be running which will run cron hourly, weekly and daily try following papibe advice and see if you get an output see if cron appears in ps

member1000
September 21st, 2011, 02:46 PM
Of course the cron daemon must run first.

So my very dirty workaround now is just to put /usr/sbin/cron into /etc/rc.local
So now when I rebot the vserver thereīs cron running as I can see by ps -edaf|grep cron
Of cource my crontab entry 15 * * * * /bin/echo "hello ..." will be executed now, I can see it and thereīs also a msg in syslog as expected.

Thereīs more elegant way how the daemons will be started. And as fare Iīve already got out thereīre condition rules which specify more precisely what cond. must be met to start a service. And now the point: when you run 11.04 on a virtual machine ... you have to disable real interfaces somewhere as I guess. Iīll continue the "investigation".
- Tony

member1000
September 21st, 2011, 03:53 PM
Well ... and now the elegant solution ... ehmmmm
Just uncomment the approp. lines in /etc/init/cron.conf

I really would like to get explained from someone WHY is cron disabled in the basic system.

And here some comments to the conditional starting of services in ubuntu 11.04-

When you start letīs say mysql or whatever in virtual environment, everything is working fine. BUT make a reboot ... and your services are not up. You have to start them manually. Unfortunate situation, isnīt it.

Here the reason: letīs take the example of mysql
In /etc/init thereīs mysql.conf ... and at the header of the conf ... there are CONDITIONS which specify when to start mysql automatically during the reboot phase.

In particular there is ...

start on ( ...
and ...
and ...)

stop on runlevel [016]

You see immediately where the troubles might lie. If any of the conditions in "start on"
arenīt met the service will not be started. So in my particular case I deleted from all my services ... vsftpd, mysql ... well and couple of others ... the condition "net-device-up" and all daemons were in place after reboot as expected.

Hope it helps save lot of time other ubuntu friends around.