Linux - Newbie This 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.
Are you new to LinuxQuestions.org? Visit the following links:
Site Howto |
Site FAQ |
Sitemap |
Register Now
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
 |
GNU/Linux Basic Guide
This 255-page guide will provide you with the keys to understand the philosophy of free software, teach you how to use and handle it, and give you the tools required to move easily in the world of GNU/Linux. Many users and administrators will be taking their first steps with this GNU/Linux Basic guide and it will show you how to approach and solve the problems you encounter.
Click Here to receive this Complete Guide absolutely free. |
|
 |
02-02-2005, 10:24 AM
|
#1
|
|
Member
Registered: Jun 2004
Distribution: Slack
Posts: 214
Rep:
|
Schedule a Script to Run
I have written a script to perform a backup. I would like it to run every day, but I don't want it sitting in a loop 24/7 waiting to run. Is there a way to schedule it to run once a day?
Thanks
|
|
|
|
02-02-2005, 10:27 AM
|
#2
|
|
Member
Registered: Jan 2004
Location: /lost+found
Distribution: Slack`er-current
Posts: 845
Rep:
|
Put it into your /etc/cron.daily file.
|
|
|
|
02-02-2005, 10:29 AM
|
#3
|
|
Member
Registered: Jun 2004
Distribution: Slack
Posts: 214
Original Poster
Rep:
|
Wow is it that easy!? Can I just dump the script in, or is there more configuring?
|
|
|
|
02-02-2005, 10:29 AM
|
#4
|
|
Member
Registered: May 2004
Location: Iowa USA
Distribution: CentOS
Posts: 419
Rep:
|
Do you have shell access? If so, you could schedule it as a cron job.
Depending on your distro, it might go something like this...
At the command line, type
crontab -e
This will open the cron table in an editor, like vi or nano or something. Then add this line:
* 2 * * * /path/to/script/scriptname
This would run the script at 2 AM every day. For help on cron jobs, Google "cron tutorial".
Hope that helps.
|
|
|
|
02-02-2005, 10:33 AM
|
#5
|
|
Member
Registered: Jun 2004
Distribution: Slack
Posts: 214
Original Poster
Rep:
|
Thanks zaichik, that looks like just what I need.
|
|
|
|
02-02-2005, 10:39 AM
|
#6
|
|
Member
Registered: Jun 2004
Distribution: Slack
Posts: 214
Original Poster
Rep:
|
zaichik - One last thing, I've had a look at the tutorials and have made my entries into crontab, but I can't find if I have to restart crontab to get it to pickup my changes. Is a crontab restart necessary and how is it done?
Thanks again
|
|
|
|
02-02-2005, 10:49 AM
|
#7
|
|
Member
Registered: May 2004
Location: Iowa USA
Distribution: CentOS
Posts: 419
Rep:
|
Nope, restarting cron is not necessary, you should be good to go. As always when you are backing data up, check to make sure the backup actually ran--don't just trust that there is not something wrong with the script or something else!
|
|
|
|
02-02-2005, 10:52 AM
|
#8
|
|
Member
Registered: Jan 2004
Location: /lost+found
Distribution: Slack`er-current
Posts: 845
Rep:
|
To kill cron and restart it
Code:
pkill cron && crond
|
|
|
|
02-02-2005, 12:37 PM
|
#9
|
|
Member
Registered: Jun 2004
Distribution: Slack
Posts: 214
Original Poster
Rep:
|
zaichik - Thanks for the tip, I'm having to rewrite it because of the previous backups failure. 
|
|
|
|
| Thread Tools |
Search this Thread |
|
|
|
Posting Rules
|
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
HTML code is Off
|
|
|
All times are GMT -5. The time now is 04:23 AM.
|
|
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.
|
Latest Threads
LQ News
|
|