?
Solved

How to Run cronjob in Linux

Posted on 2000-03-28
2
Medium Priority
?
396 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 200 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

Get proactive database performance tuning online

At Percona’s web store you can order full Percona Database Performance Audit in minutes. Find out the health of your database, and how to improve it. Pay online with a credit card. Improve your database performance now!

Question has a verified solution.

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

Setting up Secure Ubuntu server on VMware 1.      Insert the Ubuntu Server distribution CD or attach the ISO of the CD which is in the “Datastore”. Note that it is important to install the x64 edition on servers, not the X86 editions. 2.      Power on th…
You ever wonder how to backup Linux system files just like Windows System Restore?  Well you can use Timeshift in Linux to perform those similar action.  This tutorial will show you how to backup your system files and keep regular intervals. Note…
Learn several ways to interact with files and get file information from the bash shell. ls lists the contents of a directory: Using the -a flag displays hidden files: Using the -l flag formats the output in a long list: The file command gives us mor…
Learn how to find files with the shell using the find and locate commands. Use locate to find a needle in a haystack.: With locate, check if the file still exists.: Use find to get the actual location of the file.:
Suggested Courses
Course of the Month13 days, 21 hours left to enroll

800 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