LinuxQuestions.org
Review your favorite Linux distribution.
Home Forums Tutorials Articles Register
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 11-27-2003, 12:37 PM   #46
Tinkster
Moderator
 
Registered: Apr 2002
Location: earth
Distribution: slackware by choice, others too :} ... android.
Posts: 23,067
Blog Entries: 11

Rep: Reputation: 928Reputation: 928Reputation: 928Reputation: 928Reputation: 928Reputation: 928Reputation: 928Reputation: 928

Anywhere in that list will do, it's not required
to be sorted ... so, if you wanted your script to
run every evening at 8 o'clock you'd go


01 20 * * * * /<path>/<to>/norton.sh


Cheers,
Tink


P.S.: Your "file" looks nothing like mine :)
Where/how did you get that list?
 
Old 11-27-2003, 01:34 PM   #47
scottpioso
Member
 
Registered: Jan 2003
Location: United States of America and damn proud of it!
Distribution: Windows 10 prior Red Hat User
Posts: 473

Original Poster
Rep: Reputation: 30
Where did I get the file? I went to /etc/crontab. Second, isn't 8:00 in the evening 2000 hours? I'm confused as to how the times correlate to real time.

Also, will the file run in the background so I won't be interrupted with what I may be doing or will it interrupt me?

Last edited by scottpioso; 11-27-2003 at 01:41 PM.
 
Old 11-27-2003, 02:50 PM   #48
Tinkster
Moderator
 
Registered: Apr 2002
Location: earth
Distribution: slackware by choice, others too :} ... android.
Posts: 23,067
Blog Entries: 11

Rep: Reputation: 928Reputation: 928Reputation: 928Reputation: 928Reputation: 928Reputation: 928Reputation: 928Reputation: 928
Quote:
Originally posted by scottpioso
Where did I get the file? I went to /etc/crontab. Second, isn't 8:00 in the evening 2000 hours? I'm confused as to how the times correlate to real time.

Also, will the file run in the background so I won't be interrupted with what I may be doing or will it interrupt me?
Hmmm ... must be a RH thing... if I want to
add something to crontab I do
crontab -e, the result is then stored in
/var/spool/cron/crontabs/<user-id>


As for the format
man crontab
Code:
       # MIN HOUR DAY MONTH DAYOFWEEK   COMMAND
       # at 6:10 a.m. every day
       10 6 * * * date

       # every two hours at the top of the hour
       0 */2 * * * date

       # every two hours from 11p.m. to 7a.m., and at 8a.m.
       0 23-7/2,8 * * * date

       # at 11:00 a.m. on the 4th and on every mon, tue, wed
       0 11 4 * mon-wed date

       # 4:00 a.m. on january 1st
       0 4 1 jan * date

       # once an hour, all output appended to log file
       0 4 1 jan * date >>/var/log/messages 2>&1
So yes, it's 2000 (military speak) but
00 20 for cron ...

Look at this line:
# MIN HOUR DAY MONTH DAYOFWEEK COMMAND

Cheers,
Tink
 
Old 11-27-2003, 06:23 PM   #49
scottpioso
Member
 
Registered: Jan 2003
Location: United States of America and damn proud of it!
Distribution: Windows 10 prior Red Hat User
Posts: 473

Original Poster
Rep: Reputation: 30
Ah,, I see now, Tink. Thanks. However, you didn't answer my question about running in the background or will this interrupt whatever I may be working on at the time the job runs?
 
Old 11-27-2003, 07:23 PM   #50
Tinkster
Moderator
 
Registered: Apr 2002
Location: earth
Distribution: slackware by choice, others too :} ... android.
Posts: 23,067
Blog Entries: 11

Rep: Reputation: 928Reputation: 928Reputation: 928Reputation: 928Reputation: 928Reputation: 928Reputation: 928Reputation: 928
No mate, no interruptions ... that's what cron is
for. Jobs running un-attended.


Cheers,
Tink
 
Old 11-28-2003, 09:56 AM   #51
scottpioso
Member
 
Registered: Jan 2003
Location: United States of America and damn proud of it!
Distribution: Windows 10 prior Red Hat User
Posts: 473

Original Poster
Rep: Reputation: 30
Hi Tink,

So just to make sure I understand this, if I wanted a job to run at 5pm every day Mon-Fri, I would do this,

0 17 mon-fri * * [name of file]

Is my logic correct? Or do I need another * there? Secondly, what do all of the asterisks mean anyway?

Last edited by scottpioso; 11-28-2003 at 10:22 AM.
 
Old 11-28-2003, 02:48 PM   #52
Tinkster
Moderator
 
Registered: Apr 2002
Location: earth
Distribution: slackware by choice, others too :} ... android.
Posts: 23,067
Blog Entries: 11

Rep: Reputation: 928Reputation: 928Reputation: 928Reputation: 928Reputation: 928Reputation: 928Reputation: 928Reputation: 928
*sigh*

Quote:
Originally posted by scottpioso
0 17 mon-fri * * [name of file]
Quote:
Look at this line:
# MIN HOUR DAY MONTH DAYOFWEEK COMMAND
0 17 * * mon-fri <name of file with full path>


Cheers,
Tink
 
Old 11-28-2003, 02:53 PM   #53
scottpioso
Member
 
Registered: Jan 2003
Location: United States of America and damn proud of it!
Distribution: Windows 10 prior Red Hat User
Posts: 473

Original Poster
Rep: Reputation: 30
Okay, Tink,

What's the sigh all about? The only thing I was different was that I didn't have the full path indicated, right?
 
Old 11-28-2003, 03:11 PM   #54
Tinkster
Moderator
 
Registered: Apr 2002
Location: earth
Distribution: slackware by choice, others too :} ... android.
Posts: 23,067
Blog Entries: 11

Rep: Reputation: 928Reputation: 928Reputation: 928Reputation: 928Reputation: 928Reputation: 928Reputation: 928Reputation: 928
Quote:
originally by tink
Look at this line:
# MIN HOUR DAY MONTH DAYOFWEEK COMMAND
Quote:
0 17 mon-fri * * [name of file]
Quote:
0 17 * * mon-fri <name of file with full path>


Cheers,
Tink
 
Old 11-28-2003, 03:44 PM   #55
scottpioso
Member
 
Registered: Jan 2003
Location: United States of America and damn proud of it!
Distribution: Windows 10 prior Red Hat User
Posts: 473

Original Poster
Rep: Reputation: 30
Oh, now I see. DUH!! Thanks. So, now I'll just plug that line into crontab and it should run automatically, yes?

and here it is


# run-parts
01 * * * * root run-parts /etc/cron.hourly
02 4 * * * root run-parts /etc/cron.daily
22 4 * * 0 root run-parts /etc/cron.weekly
42 4 1 * * root run-parts /etc/cron.monthly
0 17 * * mon-fri /software/norton.sh

Last edited by scottpioso; 11-28-2003 at 03:55 PM.
 
Old 11-28-2003, 03:57 PM   #56
scottpioso
Member
 
Registered: Jan 2003
Location: United States of America and damn proud of it!
Distribution: Windows 10 prior Red Hat User
Posts: 473

Original Poster
Rep: Reputation: 30
Umm, something else I just noticed, should I specify root there as the other items have or does that not matter?
 
Old 11-28-2003, 03:59 PM   #57
Tinkster
Moderator
 
Registered: Apr 2002
Location: earth
Distribution: slackware by choice, others too :} ... android.
Posts: 23,067
Blog Entries: 11

Rep: Reputation: 928Reputation: 928Reputation: 928Reputation: 928Reputation: 928Reputation: 928Reputation: 928Reputation: 928
Quote:
Originally posted by scottpioso
Umm, something else I just noticed, should I specify root there as the other items have or does that not matter?
That's where the difference I noticed comes
in - I said that yours looks different from
mine ... do a
man crontab
to see what else RH did to cron ;)



Cheers,
Tink
 
Old 11-28-2003, 04:08 PM   #58
scottpioso
Member
 
Registered: Jan 2003
Location: United States of America and damn proud of it!
Distribution: Windows 10 prior Red Hat User
Posts: 473

Original Poster
Rep: Reputation: 30
This is what it gives me. It would appear that I need a flag in there somewhere, but that doesn't really make any sense as the other entries don't have flags.

Is there a test I can run on this file to check it for syntax?


CRONTAB(1) CRONTAB(1)

NAME
crontab - maintain crontab files for individual users (V3)

SYNOPSIS
crontab [ -u user ] file
crontab [ -u user ] { -l | -r | -e }
 
Old 11-28-2003, 04:15 PM   #59
scottpioso
Member
 
Registered: Jan 2003
Location: United States of America and damn proud of it!
Distribution: Windows 10 prior Red Hat User
Posts: 473

Original Poster
Rep: Reputation: 30
DESCRIPTION
Crontab is the program used to install, deinstall or list the tables
used to drive the cron(8) daemon in Vixie Cron. Each user can have
---> their own crontab, and though these are files in /var, they are not
intended to be edited directly.

If the allow file exists, then you must be listed therein in order to
be allowed to use this command. If the allow file does not exist but
the deny file does exist, then you must not be listed in the deny file
in order to use this command. If neither of these files exists, then
depending on site-dependent configuration parameters, only the super
user will be allowed to use this command, or all users will be able to
use this command.
 
Old 11-28-2003, 04:23 PM   #60
Tinkster
Moderator
 
Registered: Apr 2002
Location: earth
Distribution: slackware by choice, others too :} ... android.
Posts: 23,067
Blog Entries: 11

Rep: Reputation: 928Reputation: 928Reputation: 928Reputation: 928Reputation: 928Reputation: 928Reputation: 928Reputation: 928
I said I've never seen a file
/etc/crontab

I modify my crontabs using
crontab -e
The actual files that crontab writes on
my system(s) line in /var/spool/cron/crontabs

Maybe someone in the Linux -> Distributions -> RH forum
can shed light on what the use/usage of
/etc/crontab
is?



Cheers,
Tink
 
  


Reply



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 Jobs XaViaR Linux - General 1 06-23-2005 06:57 PM
Cron Jobs with MySQL SharkBait Mandriva 1 06-07-2005 01:23 AM
cron jobs working2hard Linux - Software 0 07-28-2004 05:31 PM
cron jobs Zyanid Linux - Software 0 08-27-2002 05:10 AM
creating cron jobs jonfa Linux - General 5 05-26-2002 05:05 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Software

All times are GMT -5. The time now is 06:21 AM.

Main Menu
Advertisement
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
Open Source Consulting | Domain Registration