View Single Post
Old 18-01-2008, 01:55 PM   #1 (permalink)
gary4gar
GaurishSharma.com
 
gary4gar's Avatar
 
Join Date: May 2005
Location: Jaipur
Posts: 4,116
Exclamation Finding & fixing problem with cron

i schedule my downloads with cron, but from past few, it isn't working(no downloads). and i need to help to first find the the problem & then fixing it.

my crontab looks like

Code:
# m h  dom mon dow   command
10 2 * * * 
10 2 * * * DISPLAY=:0.0 /opt/azureus/azureus
13 2 * * * wget -ci /home/gaurish/dl-list.txt
Root's crontab
Code:
10 2 * * *  /usr/bin/pon dsl-provider
49 7 * * * /usr/bin/poff
50 7 * * * /sbin/shutdown -h 0
mail from from cron
Quote:
From: Cron Daemon <root@moody-machine>
To: gaurish@moody-machine
Subject: Cron <gaurish@MOODY-MACHINE> cd /home/gaurish/scripts && sh router-reboot.sh | telnet
Date: Fri, 18 Jan 2008 02:10:05 +0530


telnet> Trying 192.168.1.1...
Connected to 192.168.1.1.
Escape character is '^]'.

BusyBox on localhost login: root
Password:


BusyBox v0.61.pre (2006.06.30-13:40+0000) Built-in shell (ash)
Enter 'help' for a list of built-in commands.

# reboot
Connection closed by foreign host.
^^^
i think its done successfully

Quote:
From: Cron Daemon <root@moody-machine>
To: gaurish@moody-machine
Subject: Cron <gaurish@MOODY-MACHINE> wget -ci /home/gaurish/dl-list.txt
Date: Fri, 18 Jan 2008 02:14:00 +0530


--02:13:01-- http://download-secondlife-com.s3.am...18_5_3.tar.bz2
=> `SecondLife_i686_1_18_5_3.tar.bz2'
Resolving download-secondlife-com.s3.amazonaws.com... failed: Name or service not known.
--02:13:57-- http://www.linuxcafe.org/uu/ubuntu-ultimate-1.6-dvd.iso
=> `ubuntu-ultimate-1.6-dvd.iso'
Resolving www.linuxcafe.org... 208.113.188.83
Connecting to www.linuxcafe.org|208.113.188.83|:80... failed: No route to host.

the contents of dl-list.txt file

the surprizeing part here is
1) cron started wget but for some reason downloads didn't start
2) azureus didn't come up & cron didn't even leave a mail behind stating what error



I am not sure whats wrong here, but the the reasons may be
1) network is was not up when wget was running.
2) some error in crontab config
3) cron deamon died
4) some unforeseen error happened


the script i use to reboot my router is
Code:
#!/bin/sh
#############################################
#Script Written By Gaurish Sharma                                           #
#change the password variable with your own set password         #
#the default password in most cased is 'admin'                           #
#use it in terminal as sh router-reboot.sh | telnet                       #
#(C) Gaurish Sharma 2008                                                      #
#All Right Reserved                                                               #
#############################################
add='open 192.168.1.1'
userid='root'
password='eatmypissyoublackslut'
cmd='reboot'
echo $add
sleep 1
echo $userid
sleep 1
echo $password
sleep 1
echo $cmd
sleep 1

Last edited by gary4gar; 02-10-2008 at 10:05 PM.
gary4gar is offline