- Posts: 52
- Thank you received: 0
automatic scheduling FedoraCore4
18 years 6 months ago #14522
by gainil
automatic scheduling FedoraCore4 was created by gainil
Hi,
I have FedoraCore 4. I have made a sh script for making tars of some folders, which i use for backup. Now I am doing it manually every day. Is ther any utility/software, with which I can run that script automatically daily at some perticular time??
Regards
I have FedoraCore 4. I have made a sh script for making tars of some folders, which i use for backup. Now I am doing it manually every day. Is ther any utility/software, with which I can run that script automatically daily at some perticular time??
Regards
18 years 6 months ago #14523
by eylli
Replied by eylli on topic Re: automatic scheduling FedoraCore4
use "cron"
18 years 6 months ago #14529
by Chris
Chris Partsenidis.
Founder & Editor-in-Chief
www.Firewall.cx
Replied by Chris on topic Re: automatic scheduling FedoraCore4
gainil,
As eylli suggest, you can automate this process by using 'Cron' jobs.
Cron is really two separate programs. The cron daemon, usually called cron or crond, is a continually running program that is typically part of the booting-up process.
The crond process wakes up each minute to check a set of cron table files that list tasks and the times when those tasks are to be performed. If any programs need to be run, it runs them and then goes back to sleep.
In Linux, each user has its own Crontab entries, so be sure to use one only user to execute the commands you require for that specific process.
The crontab utility has three options: -l, -r, and -e. The -l option lists the contents of the current table file for your current userid, the -e option lets you edit the table file, and the -r option removes a table file.
A cron table file is made up of one line per entry. An entry consists of two categories of data: when to run a command and which command to run.
A line contains six fields, unless it begins with a hash mark (#), which is treated as a comment. The six fields, which must be separated by white space (tabs or spaces), are:
1. Minute of the hour in which to run (0-59)
2. Hour of the day in which to run (0-23)
3. Day of the month (0-31)
4. Month of the year in which to run (1-12)
5. Day of the week in which to run (0-6) (0=Sunday)
6. The command to execute
Here are some examples to help you understand how you can apply all the above:
[code:1]
crontab -l
2 # DO NOT EDIT THIS FILE
3 # installed Sat Jul 15
4 #min hr day mon weekday command
6 30 * * * * some_command
7 15,45 1-3 * * * another_command
8 25 1 * * 0 sunday_job
9 45 3 1 * * monthly_report
[/code:1]
Lines 2 through 4 contain comments (#) and are ignored.
Line 6 runs the command some_command at 30 minutes past the hour.
Note that the fields for hour, day, month, and weekday were all left with the asterisk; therefore some_command runs at 30 minutes past the hour, every hour of every day.
Line 7 runs the command another_command at 15 and 45 minutes past the hour for hours 1 through 3, namely, 1:15, 1:45, 2:15, 2:45, 3:15, and 3:45 a.m.
Line 8 specifies that sunday_job is to be run at 1:25 a.m., only on Sundays.
Line 9 runs monthly_report at 3:45 a.m. of the first day of each month.
Again, the crontab editor to edit a new crontab entry. In this example I am asking cron to execute something every minute.
[code:1]#crontab -e
0-59 * * * * echo `date` "Hello" >>$HOME/junk.txt [/code:1]
The sixth field contains the command to echo the output from date (note the reverse quotes around date), followed by "Hello", and also the command to append the result to a file in my home directory, which is named junk.txt.
If you experience any problems or difficulties with the crontab editor, let us know!
Good luck!
As eylli suggest, you can automate this process by using 'Cron' jobs.
Cron is really two separate programs. The cron daemon, usually called cron or crond, is a continually running program that is typically part of the booting-up process.
The crond process wakes up each minute to check a set of cron table files that list tasks and the times when those tasks are to be performed. If any programs need to be run, it runs them and then goes back to sleep.
In Linux, each user has its own Crontab entries, so be sure to use one only user to execute the commands you require for that specific process.
The crontab utility has three options: -l, -r, and -e. The -l option lists the contents of the current table file for your current userid, the -e option lets you edit the table file, and the -r option removes a table file.
A cron table file is made up of one line per entry. An entry consists of two categories of data: when to run a command and which command to run.
A line contains six fields, unless it begins with a hash mark (#), which is treated as a comment. The six fields, which must be separated by white space (tabs or spaces), are:
1. Minute of the hour in which to run (0-59)
2. Hour of the day in which to run (0-23)
3. Day of the month (0-31)
4. Month of the year in which to run (1-12)
5. Day of the week in which to run (0-6) (0=Sunday)
6. The command to execute
Here are some examples to help you understand how you can apply all the above:
[code:1]
crontab -l
2 # DO NOT EDIT THIS FILE
3 # installed Sat Jul 15
4 #min hr day mon weekday command
6 30 * * * * some_command
7 15,45 1-3 * * * another_command
8 25 1 * * 0 sunday_job
9 45 3 1 * * monthly_report
[/code:1]
Lines 2 through 4 contain comments (#) and are ignored.
Line 6 runs the command some_command at 30 minutes past the hour.
Note that the fields for hour, day, month, and weekday were all left with the asterisk; therefore some_command runs at 30 minutes past the hour, every hour of every day.
Line 7 runs the command another_command at 15 and 45 minutes past the hour for hours 1 through 3, namely, 1:15, 1:45, 2:15, 2:45, 3:15, and 3:45 a.m.
Line 8 specifies that sunday_job is to be run at 1:25 a.m., only on Sundays.
Line 9 runs monthly_report at 3:45 a.m. of the first day of each month.
Again, the crontab editor to edit a new crontab entry. In this example I am asking cron to execute something every minute.
[code:1]#crontab -e
0-59 * * * * echo `date` "Hello" >>$HOME/junk.txt [/code:1]
The sixth field contains the command to echo the output from date (note the reverse quotes around date), followed by "Hello", and also the command to append the result to a file in my home directory, which is named junk.txt.
If you experience any problems or difficulties with the crontab editor, let us know!
Good luck!
Chris Partsenidis.
Founder & Editor-in-Chief
www.Firewall.cx
18 years 6 months ago #14537
by gainil
Replied by gainil on topic Re: automatic scheduling FedoraCore4
Hi,
Thanks eylli, I didnt know what is 'cron'.
Many thanks to you Chris, for explaining me in detail and also give example for the same. I tried the same exaple on my linux box, it is working fine, now I am gonaa try it for the script i mentioned in my earlier post.
I will let you know if any queries.
you guys at Firewall.cx are simply great!!!
Thanks and Regards to all
Thanks eylli, I didnt know what is 'cron'.
Many thanks to you Chris, for explaining me in detail and also give example for the same. I tried the same exaple on my linux box, it is working fine, now I am gonaa try it for the script i mentioned in my earlier post.
I will let you know if any queries.
you guys at Firewall.cx are simply great!!!
Thanks and Regards to all
Time to create page: 0.126 seconds