You are not logged in.

#1 2011-01-01 13:56:57

timecage
Member
From: Warsaw, Poland
Registered: 2010-12-31
Posts: 4
Website

[SOLVED] Cron doesn't like me :<

Hello everyone.
Sorry if this is a noob question. I'm not really new to linux. But this time I simply have no idea what I'm doing wrong.

I have this router which needs a connection traffic every few minutes to keep the connection up. So I wanted to use cron to fire wget every 5 minutes. The only problem is that cron doesn't seem to work for me.

Here is my cron file:

# root crontab
# DO NOT EDIT THIS FILE MANUALLY! USE crontab -e INSTEAD

# man 1 crontab for acceptable formats:
#    <minute> <hour> <day> <month> <dow> <tags and command>
#    <@freq> <tags and command>

# SYSTEM DAILY/WEEKLY/... FOLDERS
@hourly         ID=sys-hourly   /usr/sbin/run-cron /etc/cron.hourly
@daily          ID=sys-daily    /usr/sbin/run-cron /etc/cron.daily
@weekly         ID=sys-weekly   /usr/sbin/run-cron /etc/cron.weekly
@monthly        ID=sys-monthly  /usr/sbin/run-cron /etc/cron.monthly

*/5 * * * * wget -pc --tries=30 http://pl.wikipedia.org/images/wikimedia-button.png

Cron daemon is obviously up and running. Any help would be appreciated :<

Last edited by timecage (2011-01-11 19:03:32)

Offline

#2 2011-01-01 14:19:04

loafer
Member
From: the pub
Registered: 2009-04-14
Posts: 1,772

Re: [SOLVED] Cron doesn't like me :<

Are you sure it isn't working.  The command is ok.  It is root's crontab you have edited so maybe the file is downloaded to root's home dir and not your user.  Try adding it to your crontab.


All men have stood for freedom...
For freedom is the man that will turn the world upside down.
Gerrard Winstanley.

Offline

#3 2011-01-01 14:21:01

timecage
Member
From: Warsaw, Poland
Registered: 2010-12-31
Posts: 4
Website

Re: [SOLVED] Cron doesn't like me :<

Thanks for your reply.
I want it to work on root account. And I'm aware that the file will be downloaded to /root. That's what I want. But it doesn't work :<

Offline

#4 2011-01-01 14:24:54

loafer
Member
From: the pub
Registered: 2009-04-14
Posts: 1,772

Re: [SOLVED] Cron doesn't like me :<

What does it say in crond.log?


All men have stood for freedom...
For freedom is the man that will turn the world upside down.
Gerrard Winstanley.

Offline

#5 2011-01-01 14:26:37

karol
Archivist
Registered: 2009-05-06
Posts: 25,440

Re: [SOLVED] Cron doesn't like me :<

Works here too (using user's crontab, not root's). You're downloading the whole dir structure: pl.wikipedia.org/images/wikimedia-button.png instead of saving just the wikimedia-button.png, not sure if it's intended.

How do you know it doesn't work?

Last edited by karol (2011-01-01 14:27:08)

Offline

#6 2011-01-01 14:57:33

timecage
Member
From: Warsaw, Poland
Registered: 2010-12-31
Posts: 4
Website

Re: [SOLVED] Cron doesn't like me :<

Jan  1 15:30:01 localhost crond[1202]: FILE /var/spool/cron/root USER root PID 1604 job sys-hourly
Jan  1 15:30:01 localhost crond[1202]: FILE /var/spool/cron/root USER root PID 1605 wget -pc --tries=30 http://pl.wikipedia.org/images/wikimedia-button.png
Jan  1 15:30:01 localhost crond[1608]: mailing cron output for user root wget -pc --tries=30 http://pl.wikipedia.org/images/wikimedia-button.png
Jan  1 15:30:01 localhost crond[1608]: unable to exec /usr/sbin/sendmail: cron output for user root wget -pc --tries=30 http://pl.wikipedia.org/images/wikimedia-button.png to /dev/null
Jan  1 15:35:01 localhost crond[1202]: FILE /var/spool/cron/root USER root PID 1618 wget -pc --tries=30 http://pl.wikipedia.org/images/wikimedia-button.png
Jan  1 15:35:01 localhost crond[1619]: mailing cron output for user root wget -pc --tries=30 http://pl.wikipedia.org/images/wikimedia-button.png
Jan  1 15:35:01 localhost crond[1619]: unable to exec /usr/sbin/sendmail: cron output for user root wget -pc --tries=30 http://pl.wikipedia.org/images/wikimedia-button.png to /dev/null
Jan  1 15:40:01 localhost crond[1202]: FILE /var/spool/cron/root USER root PID 1620 wget -pc --tries=30 http://pl.wikipedia.org/images/wikimedia-button.png
Jan  1 15:40:01 localhost crond[1621]: mailing cron output for user root wget -pc --tries=30 http://pl.wikipedia.org/images/wikimedia-button.png
Jan  1 15:40:01 localhost crond[1621]: unable to exec /usr/sbin/sendmail: cron output for user root wget -pc --tries=30 http://pl.wikipedia.org/images/wikimedia-button.png to /dev/null

That's some of the last lines of crond.log.
I know it doesn't work simply because the last modified timestamp on the file and the directory does not change \o/

Offline

#7 2011-01-01 15:27:25

loafer
Member
From: the pub
Registered: 2009-04-14
Posts: 1,772

Re: [SOLVED] Cron doesn't like me :<

It does work.  Change the wget comment so that it is "wget -p ...".  It will then download a new copy of the file each time.

edit:  do you really need to download a file.  Couldn't you just ping.

Last edited by loafer (2011-01-01 15:32:27)


All men have stood for freedom...
For freedom is the man that will turn the world upside down.
Gerrard Winstanley.

Offline

#8 2011-01-11 19:05:37

timecage
Member
From: Warsaw, Poland
Registered: 2010-12-31
Posts: 4
Website

Re: [SOLVED] Cron doesn't like me :<

Sorry for the late reply. You were all right of course. And it was stupid of me to forget about something as trivial as crond.log smile
It turned out the router is picky and wouldn't stay alive with only that small file being downloaded. I used

ping -s 1024 -c 10 google.com

and it solved the problem.

Offline

Board footer

Powered by FluxBB