LinuxQuestions.org
Help answer threads with 0 replies.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices

Reply
 
Search this Thread
Old 12-10-2004, 01:29 AM   #1
Lleb_KCir
Senior Member
 
Registered: Nov 2003
Location: Orlando FL
Distribution: Debian
Posts: 1,765

Rep: Reputation: 45
newbie needing help creating a cron job


Code:
# which svc
/usr/local/bin/svc
# cat > /etc/cron.d/restart-imap
3 0-23/2 * * *{TAB}/usr/local/bin/svc -t /service/imap*
^D
ok i want to turn that into a cron job, but i have not the fogiest clue when it comes to coding or even were or how to save something like this.

*note* when it states {TAB} that is to hit the tab key

i got this off a site that should help me resolve one of the hickups my whitebox q-mail server is having with IMAP.

A. what path do i save the file in once it is created?
B. what extention and file name format do i give it so cron knows what to do.

yes i read man cron, but it confused the daylights out of me. from what little i could gather it gets its info from /etc/init.d, but that is just a list of services, nothing i can edit to add the above code.

help...

thanks.
 
Old 12-10-2004, 07:04 AM   #2
hob
Senior Member
 
Registered: Mar 2004
Location: Wales, UK
Distribution: Debian, Ubuntu
Posts: 1,075

Rep: Reputation: 45
Red Hat has a easy option for this - every script file in /etc/cron.hourly will be executed every hour.

I don't know if Debian has this. If not then you use:

crontab -e

This will open the crontab file for the user in the default text editor and you can save the changes in the normal way when done.

/etc/init.d is for service scripts. Crontab files live in a subdirectory of /var, but you should use the crontab command rather than poke them directly.
 
Old 12-10-2004, 07:46 AM   #3
Emerson
Senior Member
 
Registered: Nov 2004
Location: Saint Amant, Acadiana
Distribution: Gentoo ~
Posts: 3,177

Rep: Reputation: Disabled
Tip!

Use full path in the crontab, even if the executable you want to run is on your path. Like this:

/usr/bin/my_coffee_maker
 
Old 12-10-2004, 11:27 AM   #4
Lleb_KCir
Senior Member
 
Registered: Nov 2003
Location: Orlando FL
Distribution: Debian
Posts: 1,765

Original Poster
Rep: Reputation: 45
thanks for trying. i just so do not get this cron stuff... when i did the crontab -e it was a blank file, now i know that is not correct, and when i whereis crontab i found it /usr/bin/crontab and used vim to open it into a bunch of what looks like junk on the screen indicating to me that it is not in a text format to be edited in a normal fassion.

*hangs head* so lost, but someday ill figure this stuff out.
 
Old 12-11-2004, 03:23 AM   #5
hob
Senior Member
 
Registered: Mar 2004
Location: Wales, UK
Distribution: Debian, Ubuntu
Posts: 1,075

Rep: Reputation: 45
The file in /usr/bin is the crontab program, which is managed by the service script in /etc/init.d.

Every minute cron is run and checks the crontab files for each user in /var/spool/cron. A user creates or edits their crontab file with 'crontab -e', and the instructions inside are run with that user's account. So to set up system tasks you will often want to do 'crontab -e' as root. The crontab file is empty to start with, and you can put the stuff you listed in the first post in it.

Red Hat systems will also run the scripts in /etc/cron.d/hourly, /etc/cron.d/daily and /etc/cron.d/weekly, as well as the crontab files for the users.

Last edited by hob; 12-11-2004 at 03:25 AM.
 
Old 12-13-2004, 03:58 PM   #6
Lleb_KCir
Senior Member
 
Registered: Nov 2003
Location: Orlando FL
Distribution: Debian
Posts: 1,765

Original Poster
Rep: Reputation: 45
thanks.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
cron job? dr_zayus69 Linux - Newbie 14 12-01-2004 06:16 PM
cron job working2hard Programming 6 07-28-2004 09:12 PM
cron job sanjith11 Linux - General 5 07-14-2004 01:06 PM
Cron Job imanahmadi Linux - Newbie 1 07-03-2003 11:39 PM
Cron job T-Rex Linux - Newbie 1 09-26-2001 11:28 AM


All times are GMT -5. The time now is 02:38 AM.

Main Menu
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration