Linux - NewbieThis Linux forum is for members that are new to Linux.
Just starting out and have a question?
If it is not in the man pages or the how-to's this is the place!
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
First you have to check if the cron daemon is running and if you as a user are allowed to run cron jobs, but don't worry too much, since Linux enables that by default (just check if something doesn't work). To write your own crontab you will issue the command
Code:
crontab -e
it will open a vi session in which you can write your own cron jobs. Then save and quit and the system will store the proper file in the proper location automatically. Check man crontab for other options of the crontab command (for example to display or to remove the current crontab).
For the format of a crontab line, that is how to specify a cron job see
Code:
man 5 crontab
it describes the crontab format and gives some useful examples. If you're in trouble feel free to ask.
I have created a script to take backup. when i run this script using the browser it will work fine and create tar.gz files but when i try to run this using the command line in Linux it will display a error:
tar: Removing leading `/' from member names
now what to do to solve this problem.
my script code is below
###### script code start here #############
When you are executing a script from cron, you should be careful to expand all paths in your script. You might be running the script from a location where you have all the files needed and the script might execute just fine from the command line. But when you put it in the cron file , it will fail. This is a common mistake we do.
To run a cronjob every 15 minutes another way would be :
The first meathod would not be very easy to use if say for example you want to run it every 5 minutes. So use a */5 and you will get it executed every 5 miutes.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.