Solved

How to Run cronjob in Linux

Posted on 2000-03-28
2
395 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

Enroll in June's Course of the Month

June’s Course of the Month is now available! Experts Exchange’s Premium Members, Team Accounts, and Qualified Experts have access to a complimentary course each month as part of their membership—an extra way to sharpen your skills and increase training.

Question has a verified solution.

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

SSH (Secure Shell) - Tips and Tricks As you all know SSH(Secure Shell) is a network protocol, which we use to access/transfer files securely between two networked devices. SSH was actually designed as a replacement for insecure protocols that sen…
1. Introduction As many people are interested in Linux but not as many are interested or knowledgeable (enough) to install Linux on their system, here is a safe way to try out Linux on your existing (Windows) system. The idea is that you insta…
Learn how to get help with Linux/Unix bash shell commands. Use help to read help documents for built in bash shell commands.: Use man to interface with the online reference manuals for shell commands.: Use man to search man pages for unknown command…
How to Install VMware Tools in Red Hat Enterprise Linux 6.4 (RHEL 6.4) Step-by-Step Tutorial

691 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