| Author |
Message |
StevenR
Joined: 13 Nov 2007 Posts: 2
|
Posted: Tue 13 Nov 2007, 19:15 Post subject:
How to set a cron job Subject description: I can't get Gcrontab to work ... and crontab -e won't work |
|
I have my scripts ready. They're in /usr/local/bin. They're executable. I've tested them.
But I can't seem to get the cron job to work.
Since Puppy has no vi, crontab -e doesn't work.
I'm trying to use Gcrontab, but I'm not sure how it works.
This page is no help: http://www.arquired.es/users/aldelgado/proy/gcrontab/
And I have yet to find any explanation of how to make the cron jobs work.
Does anybody have a tutorial or any kind of documentation for Gcrontab?
|
|
Back to top
|
|
 |
trapster

Joined: 28 Nov 2005 Posts: 1966 Location: Maine, USA
|
Posted: Tue 13 Nov 2007, 20:22 Post subject:
|
|
Here might help
_________________ trapster
Maine, USA
Asus eeepc 1005HA PU1X-BK
Frugal install:Puppeee4.31 + 1.0, Puppy4.10 + Lupu52
Currently using Puppeee-1.0 AND lupu52 w/ fluxbox
|
|
Back to top
|
|
 |
HairyWill

Joined: 26 May 2006 Posts: 2949 Location: Southampton, UK
|
Posted: Wed 14 Nov 2007, 00:53 Post subject:
|
|
zigberts Pschedule seems a lot more intuitive than gcrontab. Here is the thread where you can get it:
http://www.murga-linux.com/puppy/viewtopic.php?t=22166
_________________ Will
contribute: community website, screenshots, puplets, wiki, rss
|
|
Back to top
|
|
 |
paulh177

Joined: 22 Aug 2006 Posts: 869 Location: ST862228
|
Posted: Wed 14 Nov 2007, 03:49 Post subject:
|
|
As a thread of mine got namechecked, I'll summarise what I did:
Make sure your system timezone, date and time is set correctly
Make sure cron is starting -- put | Code: | | /usr/sbin/crond -L /tmp/cronjobs.log | in your rc.local. You can use whatever logfile name and location you like of course, but just having one could help track down problems.
Reboot and check with ps that cron is running.
Use Gcrontab or pschedule (both are OK even if needing a little work yet) to set up a test schedule - or if like me you're a sick man, use e3vi to create one from scratch.
I set up a little scriptfile to echo a few characters to a file.
Set the schedule to say 15 mins in the future, and reboot again.
Watch for the output of your test, and watch the output of your logfile (I used tail -f /tmp/cronjobs.log)Various threads on various boards seemed to indicate that stray characters in the /var/spool/cron/crontabs/root file could cause cron to fail, and although I edited the file produced by pschedule and Gcrontab, and cron started to work, I am not convinced that that was the problem with my setup -- I think it was coincidental.
But it's worth a try if yours doesn't work.
The time/date/timezone thing is really important, because otherwise cron might be working but isn't on the same clock as you (!).
As an example, I had the wrong time/TZ set on a gentoo system; I was building it using cron to schedule an emerge; cron triggered a massive download when I wasn't expecting it and I ended using a great lump of my broadband account's download limit in one hit ...
Getting something like this to work when you're struggling means taking a stepwise approach, changing only one thing at a time, and testing after each change. I say that because I'm crap at doing just that and go in scattergun too often, but it's rarely an effective approach, and if it does fix something, I'm never sure what fixed it.
Hope this is of help
Paul
|
|
Back to top
|
|
 |
StevenR
Joined: 13 Nov 2007 Posts: 2
|
Posted: Wed 14 Nov 2007, 19:53 Post subject:
|
|
That worked. That line to get crond running was the "missing piece."
Thanks!
I still think Gcrontab is barbaric. I'm a little hazy on what you do to make your crontab active. In Gcrontab, I open my crontab file (I saved it as /etc/crontab, although I'm not sure that's mandatory) and "set current file."
I'd love to be able to edit it with Geany, e3 or whatever and let that be that, but I think that I need Gcrontab to make it active.
I did have to create the file in Geany because I needed the first part to be */5 (to run the job every five minutes) and I couldn't get Gcrontab to do that. But then I had to open the crontab file in Gcrontab and "set" it ...
At any rate, it's working, and I thank you all.
|
|
Back to top
|
|
 |
alienjeff

Joined: 08 Jul 2006 Posts: 2290 Location: Winsted, CT - USA
|
Posted: Wed 14 Nov 2007, 23:46 Post subject:
|
|
Remember that crontab and crond are symlinks to BusyBox, so these apps are probaby going to be different than those of core apps in standard distros - just in case that's from where you're drawing experience.
_________________ hangout: ##arch-ftw on irc.freenode.net
diversion: http://alienjeff.net - visit The Fringe
quote: "The foundation of authority is based upon the consent of the people." - Thomas Hooker
|
|
Back to top
|
|
 |
paulh177

Joined: 22 Aug 2006 Posts: 869 Location: ST862228
|
Posted: Thu 15 Nov 2007, 03:55 Post subject:
|
|
| StevenR wrote: | | I'm a little hazy on what you do to make your crontab active ... I think that I need Gcrontab to make it active. |
Bearing in mind alienjeff's apposite comment, my understanding of cron is that, so long as it is running, the only other thing it needs is the presence of the user file in the correct place. i.e. cron runs as a daemon and its job is to check for the existence of the file, and if it exists read it and if there is a job to be executed in the minute of checking, execute it.
Gcrontab is only a way of maintaining /var/spool/cron/crontabs/root (or whatever user) so far as I can see, althought "barbaric" is a little strong!
I have little experience of cron except getting it running on puppy so if I'm wrong in any matters of fact I hope someone will correct me.
paul
|
|
Back to top
|
|
 |
Wavy
Joined: 21 Jan 2010 Posts: 1
|
Posted: Thu 21 Jan 2010, 01:02 Post subject:
|
|
| Quote: | | /usr/sbin/crond -L /tmp/cronjobs.log |
Thanks, cron is now running smoothly! I ran this through the command line and everything came to life. Even though the thread is over two years old, the advice is still good. I just started playing with Puppy 4.3.1 and can finally sit back and watch some PHP scripts run automatically. Now to add the command to the startup script...
|
|
Back to top
|
|
 |
MeKino
Joined: 13 Feb 2010 Posts: 8
|
Posted: Sat 20 Feb 2010, 05:30 Post subject:
cron variables |
|
Hi,
I am trying to set up a cron job where the output is to a file and the filename is appended with the date & time.
I have been able to do this before using -%d-%m-%Y-%H:%M but this does not work in Puppy.
Does anybody have any ideas?
Thanks for your help.
Kino
|
|
Back to top
|
|
 |
enhu

Joined: 26 May 2009 Posts: 299
|
Posted: Mon 28 Jun 2010, 15:30 Post subject:
|
|
anyone might just want to share a script which i can use in cron to work please:D
i'm trying to learn bash:D
|
|
Back to top
|
|
 |
|