Solved

How to Run cronjob in Linux

Posted on 2000-03-28
2
394 Views
Last Modified: 2010-04-20
Hi Linux Expert,
I'm Linux Novice. If I want to run cron job in my Linux server to periodically(at 8am, 12noon and 5pm every day except Sunday) copy some files from one Linus server to another backup Linux server, what need to be set up on the server that will run the cron job?
Pls describe how to check and set up the required deamon to run.
And give a sample of the cronjob entry format too.
TQ,
Jiayi
0
Comment
Question by:jiayiloo
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 
LVL 1

Accepted Solution

by:
bcoleman earned 50 total points
ID: 2664174
Run 'crontab -e' as root to edit the file you set up for cron jobs.

Format of crontab file:
M H D M W N

M - Minute
H - Hour
D - Day of Month
M - Month
W - Day of Week ( 0 or 7 = Sunday )
N - Path of file to run

A field may be an asterisk(*), which always stands for "first-last"

Your file:
0  8 * * 1-6 /usr/bin/yourscript
0 12 * * 1-6 /usr/bin/yourscript
0 17 * * 1-6 /usr/bin/yourscript


/usr/bin/yourscript can be a script you write to copy the files necessary or a program you write.

To check is cron is running.
1. One way is to do a 'ps ax', and see if cron or crond is running.
2. If running RedHat run linuxconf go into Control-><Control Panel>->Control Service activity and see if cron is running that way.  If not you can setup cron to start every boot up, and you can start it manually then to.

Hope this helps!!!
0
 
LVL 40

Expert Comment

by:jlevie
ID: 2664237
You can also run "crontab -e" as a user and the system will create a crontab for that user. It's not required that all cron jobs be run from root's crontab.
0

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

If you use Debian 6 Squeeze and you are tired of looking at the childish graphical GDM login screen that is used by default, here's an easy way to change it. If you've already tried to change it you've probably discovered that none of the old met…
I. Introduction There's an interesting discussion going on now in an Experts Exchange Group — Attachments with no extension (http://www.experts-exchange.com/discussions/210281/Attachments-with-no-extension.html). This reminded me of questions tha…
Connecting to an Amazon Linux EC2 Instance from Windows Using PuTTY.
Get a first impression of how PRTG looks and learn how it works.   This video is a short introduction to PRTG, as an initial overview or as a quick start for new PRTG users.

739 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question