Bekijk de volledige versie : Problem with simple cron jobs
Hi everybody,
In order to keep my money, I've changed for a low cost Internet Provider (Erevia) to connect via ISDN (because I can't get ADSL before next century).
This provider may let me staying connected 12 hours per 12 hours (i.e. from 7am to 7pm with 1 login/pwd and from 7 pm to 7 am with another login/pwd).
If I stay connected with the bad login I'm charged.
I have 2 ISDN routers but none of them can get 2 kind of connection differentiated by the time.
So I wonder if, with the help of Crond, I can connect via router #1 (with a fixed IP address) if time is between 7 am and 7pm and via router #2 (with another IP address) if time is between 7pm and 7am. I also need to disconnect @ 6:59am an reconnect @7:01.
I get WL500g with the nice Oleg FW 1.9.2.7-3c and it works really nice.
Thank you very much for your help !
Regards
Oldudu
I have problem with crond. When I define very simple command to run in crontabs like this:
30 * * * * mkdir /tmp/harddisk/a
is it ok but when I define something like this:
30 1 * * * mkdir /tmp/harddisk/a
the command is not run. I tried also 30 01 .............. with the same result.
The commands on lines 3 - 6 aren't working (see attachment).
Where is problem?
I´m using Asus WL500b, last Oleg's FW and crond which is in busybox which is downloaded form Direct Downloads from here.
And some interesting thing : my crontab file must be named admin not root. With name root it isn't working at all.
tomilius
11-04-2005, 07:51
I don't know much about cron, but I can give you these suggestions: check the syslog; check some guides on Google.
There is no problem in syslog, and the commands are maybe good. Controled with linux.about.com and others www Linux pages.
There's a howto about cron in the HOWTO section...But perhaps that doesn't solve your problem....anyway, check it out.
I have problem with crond. When I define very simple command to run in crontabs like this:
is it ok but when I define something like this:
the command is not run. I tried also 30 01 .............. with the same result.
The commands on lines 3 - 6 aren't working (see attachment).
Where is problem?
I´m using Asus WL500b, last Oleg's FW and crond which is in busybox which is downloaded form Direct Downloads from here.
And some interesting thing : my crontab file must be named admin not root. With name root it isn't working at all.
crond is already included in the firmware, so try with built one.
:eek: So the problem is solved! Crond from Oleg's FW is working without problems,but Cron from Download section has some problem with time. It "thinks" that the time is for example not 20:00 but 18:00. So the commands were done with 2 hours delay!
I have had a similar problem with awk. When ever I run a date command or a script containing a date command from command line I get UTC time, and not my timezone. If however the same script is started by crond the time is correct. Strange...
If I run the date applet from full busybox I get:
Tue Apr 12 06:25:51 UTC 2005
The built in date however shows:
Tue Apr 12 08:25:58 METDST 2005
Not a big problem, but is there a way to make full busybox show local time?
S.
unslung contains busybox package - I hope it's "full". Try using it (you could just try to extract binary from the ipk).
I want to execute a simple cron job every minute. My /var/spool/cron/crontabs/admin contains this line:
* * * * * /tmp/harddisk/bin/camsrv -r VGA -f /tmp/harddisk/tmp/display.jpg -D /dev/video
My post-boot script contains this line:
crontab /var/spool/cron/crontabs/admin
But it does not start. The command will not execute. I can't even get cron started manually. Can comeone help me?
I use Olegs 1.9.2.7-5a firmware.
Thanks.
I want to execute a simple cron job every minute. My /var/spool/cron/crontabs/admin contains this line:
* * * * * /tmp/harddisk/bin/camsrv -r VGA -f /tmp/harddisk/tmp/display.jpg -D /dev/videoMy post-boot script contains this line:
crontab /var/spool/cron/crontabs/adminBut it does not start. The command will not execute. I can't even get cron started manually. Can comeone help me?
I use Olegs 1.9.2.7-5a firmware.
Thanks.
In post-mount it should be
/usr/sbin/crond
Crontab program is only used for manipulating cron schedules, cron itself is crond.
HTH,
Roofcat
And make sure to add /var/spool/cron/crontabs/admin to /usr/local/.files
S.
PS: Did you see the howto? http://wl500g.info/showthread.php?t=1058
Thanks, RoofCat. I have changed the line in the post-mount file, and that did the trick.
Barsju: Yes, I followed the HOWTO, but it seemes like it containes an error. You wrote this:
echo "crontab" >> /usr/local/sbin/post-boot. This did not work for me, and I changed this line into /usr/sbin/crond and it worked. I use the 1.9.2.7-5a firmware.
Right you are. Sorry for that. I should test my scripts before writing howto's..
Anyways, thanx for headsup. I fixed the howto now so others shouldn't get same problem..
S.
Hi,
i have read the tutorial about installing cron with 1.9* firmware. But to do this I need USB-HDD or similar. But i haven't one.
First point in the turorial is installing cron with ipkg. why i have to install cron again? there is a crond and crontab on my wl500g.
but there is always this errormessage:
crontab: cannot change dir to /var/spool/cron/crontabs: No such file or directory
when i want to start crontab.
what's the problem now? need i usb hdd for using cron? are'nt there other ways.
greeting joe
Jean-Fabrice
23-08-2005, 21:38
what's the problem now?
PEBKAC problem ;)
search button for 'crontabs' gives :
http://wl500g.info/showthread.php?t=1058
http://wl500g.info/showthread.php?t=1737
I use the firmware crond and crontab. In de post-mount/post-boot script I enter mkdir -f /var/spool/cron/crontabs. Copy the cron file (e.g. admin) to the /var/spool/cron/crontabs directory and start crond. Works like a charm!
#!/bin/sh
mkdir -p /var/spool/cron/crontabs
cp /tmp/harddisk/own/admin /var/spool/cron/crontabs/.
crond
You could use the flashfs tool to store the cron tab (the file admin), so no external USB storage needed. .
Good luck!
Hi,
By default cron is not installed, but thru the web interface it's possible to define actions linked to time/day
For example in Wireless/Advanced it's possible to Enable Radio some days and during time frame
Someone knows what are the embeded commands used for this ?
Regards
watchdog.
anyway cron is in the custom firmware already.
i think, i have probleme with cron
cron -x test get:
debug flags enabled: test
cron: can't lock /opt/var/run/cron.pid, otherpid may be 623: Resource temporarily unavailable
log_it: (CRON 665) DEATH (can't lock /opt/var/run/cron.pid, otherpid may be 623: Resource temporarily unavailable)
please help!
Hello,
i need help, i installed the Crontab tutorial by Macsat.
And now I get this in the Log:
Feb 5 19:06:01 /opt/sbin/cron[95]: (*system*) BAD FILE MODE (/opt/etc/crontab
What can I do?
Hello!!
I have the same problem!!
Did you solve it?
How did you solve it?
mine are -rw-------
Martin
mine are -rw-------
Martin
I know "BAD FILE MODE" means File permissions.
I testet a lot yersterday with permissions, but not -rw------- !
I will test it, thank you!
[In redhat linux the permissions must be 0644, confusing :confused: ]
Thank you so much!!
Now it works perfectly!!!
marcus7601
02-06-2006, 22:45
Thanks!!!!!!!!! I spend 3 hours due to the same error tonight..finally solved it because of this eminent forum.
You guys rock.
I use the firmware crond and crontab. In de post-mount/post-boot script I enter mkdir -f /var/spool/cron/crontabs. Copy the cron file (e.g. admin) to the /var/spool/cron/crontabs directory and start crond. Works like a charm!
#!/bin/sh
mkdir -p /var/spool/cron/crontabs
cp /tmp/harddisk/own/admin /var/spool/cron/crontabs/.
crond
You could use the flashfs tool to store the cron tab (the file admin), so no external USB storage needed. .
Good luck!
Hello,
1.) I have directory /var/spool/cron/crontabs and file admin in this directory
2.) content of file admin: * * * * * echo "test" >> /opt/pavel/testcron
3.) crond is running (i have it in file post-boot and i see it after command ps)
result: in the file testcron i see no new lines ("test")
notes:
a) if i enter "echo "test" >> /opt/pavel/testcron" in command line, the new line is added to file testcron - so that the command is OK
b) I tested also other commands - with no effect
c) I have restarted my asus several times with no effect
d) when i type "crontab -e", i see this message: You (admin) are not allowed to use this program (crontab) See crontab (1) for more information
Can anybody help me? Thank you.
FilimoniC
10-07-2006, 13:35
Thing this will hangup router :) ^)))
Use it less often.
bytheway. i think crontab is little buggy (tried to use it later - bash script execution. Executes script partially (that's strange)