Puppy Linux Discussion Forum Forum Index Puppy Linux Discussion Forum
Puppy HOME page : puppylinux.com
"THE" alternative forum : puppylinux.info
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

The time now is Wed 26 Nov 2014, 07:33
All times are UTC - 4
 Forum index » House Training » Beginners Help ( Start Here)
How to set a cron job?
Moderators: Flash, Ian, JohnMurga
Post_new_topic   Reply_to_topic View_previous_topic :: View_next_topic
Page 1 of 1 Posts_count  
Author Message
StevenR

Joined: 13 Nov 2007
Posts: 2

PostPosted: Tue 13 Nov 2007, 19:15    Post_subject:  How to set a cron job?
Sub_title: 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
View user's profile Send_private_message 
trapster


Joined: 28 Nov 2005
Posts: 2027
Location: Maine, USA

PostPosted: 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 Slacko AND lupu52 w/ fluxbox
Back to top
View user's profile Send_private_message Visit_website 
HairyWill


Joined: 26 May 2006
Posts: 2949
Location: Southampton, UK

PostPosted: 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
View user's profile Send_private_message 
paulh177


Joined: 22 Aug 2006
Posts: 875
Location: ST862228

PostPosted: 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
View user's profile Send_private_message 
StevenR

Joined: 13 Nov 2007
Posts: 2

PostPosted: 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
View user's profile Send_private_message 
alienjeff


Joined: 08 Jul 2006
Posts: 2291
Location: Winsted, CT - USA

PostPosted: 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: ##b0rked 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
View user's profile Send_private_message 
paulh177


Joined: 22 Aug 2006
Posts: 875
Location: ST862228

PostPosted: 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
View user's profile Send_private_message 
Wavy

Joined: 21 Jan 2010
Posts: 1

PostPosted: 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
View user's profile Send_private_message 
MeKino

Joined: 13 Feb 2010
Posts: 8

PostPosted: 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
View user's profile Send_private_message 
enhu


Joined: 26 May 2009
Posts: 301

PostPosted: 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
View user's profile Send_private_message Visit_website 
Questor

Joined: 03 Nov 2013
Posts: 1

PostPosted: Sun 03 Nov 2013, 18:06    Post_subject: cron half working for me using frugal install Puppy 5.2.8
Sub_title: hello word message works, but script for youtube file downloads doesn't
 

I can execute my script in RoxTerm just fine. The script is
perl -T youtube_wget_video.pl http://www.youtube.com/watch?v=Fh4wKUnoKtw mp4

When I put this same script in Pschedule, it does not run.
My time and date and time zone is set correctly

I can run a basic hello world script OK using Pschedule.

Pschedule wont EXECUTE NOW my youtube script either.

sh-4.1# ps -ef | grep cron | grep -v grep gives me the following output.
root 6408 1 0 15:09 ? 00:00:00 /usr/sbin/crond -L /tmp/cronjobs.log

plus I know cron is running because it does a delayed "hello world" output to the screen.

I've put /usr/sbin/crond -L /tmp/cronjobs.log
in my rc.local.

but cronjobs.log always has a zero size. Nothing gets logged to it.

I've opened /var/spool/cron/crontabs/root and looked for extra char's. I found none.

I would like to eventually be able to use Pschedule or cron to download youtube videos from midnight to 6a and do hard disk backups during these hours too.

Any thoughts as to what I may be doing wrong?
Back to top
View user's profile Send_private_message 
don570


Joined: 10 Mar 2010
Posts: 3379
Location: Ontario

PostPosted: Mon 04 Nov 2013, 19:04    Post_subject:  

You should post in the pschedule thread and Zigbert might answer.

I'm not an expert but other Puppy users seem to use
the wget command to download???

_____________________________

Zigbert has written a script called pclock

One of the features is to execute a command after a certain number of
minutes over and over. (It's not explained very well by Zigbert
so few people know of the feature)

You should try it as well.

__________________________________________
Back to top
View user's profile Send_private_message 
RetroTechGuy


Joined: 15 Dec 2009
Posts: 2669
Location: USA

PostPosted: Tue 05 Nov 2013, 00:37    Post_subject:  

don570 wrote:
You should post in the pschedule thread and Zigbert might answer.

I'm not an expert but other Puppy users seem to use
the wget command to download???


For vids, I use the Firefox plugin "Video Downloadhelper"

https://addons.mozilla.org/en-US/firefox/addon/video-downloadhelper/?src=search

Click on the down-arrow icon that appears next to the rotating "atom". Select format/size and save it somewhere.

Of course, that doesn't give you a way to chron job it to run in the middle of the night...

_________________
Add swapfile
Back to top
View user's profile Send_private_message 
Display_posts:   Sort by:   
Page 1 of 1 Posts_count  
Post_new_topic   Reply_to_topic View_previous_topic :: View_next_topic
 Forum index » House Training » Beginners Help ( Start Here)
Jump to:  

Rules_post_cannot
Rules_reply_cannot
Rules_edit_cannot
Rules_delete_cannot
Rules_vote_cannot
You cannot attach files in this forum
You can download files in this forum


Powered by phpBB © 2001, 2005 phpBB Group
[ Time: 0.0925s ][ Queries: 12 (0.0073s) ][ GZIP on ]