Hi
Enigma 2 Receivers facilities are superb and the same potential that I know many of these capabilities.
Cron is the name of one of these capabilities.
We have a program or command in a Cron job to run automatically provide a point of time.
Now that our program is a shell script that I rebooted the server, or even instead of a command to give, For example, "every seven days, a date that represents the time and date command is run.
All this is done by Cron.
Cron service always runs in the Background and permanently.
Cron is the sex of my files in your /etc/cron.d/ is located, to understand this in your server address enter the following command in SSH:
Cron service always addresses /etc/cron.d and /var/spool/cron/ checks.
How to install and create Cronjobs:
Using Cronjobs:
Code:
1 2 3 4 5 /path/to/command arg1 arg2
or
Code:
1 2 3 4 5 /root/script.sh
Description:
1 minutes (0-59)
2: Time (0-23)
3 days (0-31)
4: Month (0-12 [12 == December])
5: Day of week (0-7)
Command: /path/to/command/ - Script or command must be run.
View all Crontab jobs:
Code:
crontab -l crontab -u username -l
Clear CronTab Jobs:
Code:
crontab -r crontab -r -u username
Contents of a file /etc/crontab/:
Code:
SHELL=/bin/bash PATH=/sbin:/bin:/usr/sbin:/usr/bin MAILTO=root HOME=/ # run-parts 01 * * * * root run-parts /etc/cron.hourly 02 4 * * * root run-parts /etc/cron.daily 22 4 * * 0 root run-parts /etc/cron.weekly 42 4 1 * * root run-parts /etc/cron.monthly
Description directories:
All scripts that want to run here and leave their name in the /etc/cron.d/ are.
All scripts that are executed only once a day:
All scripts that are executed each only once per hour:
All scripts that are executed at once:
How to use this directory to run our script?
We want the script with clean.cache delete the cache will run every 10 days. This script file in /etc/cron.daliy/ put.
So we have a file with this address: /etc/cron.daily/clean.cache/ that its contents are as follows:
Code:
#!/bin/bash # A sample shell script to clean cached file from lighttpd web server CROOT=”/tmp/cachelighttpd/” DAYS=10 LUSER=”lighttpd” LGROUP=”lighttpd” # start cleaning /usr/bin/find ${CROOT} -type f -mtime +${DAYS} | xargs -r /bin/rm # if directory deleted by some other script just get it back if [ ! -d $CROOT ] then /bin/mkdir -p $CROOT /bin/chown ${LUSER}:${LGROUP} ${CROOT} fi
How to backup Cronjob Started:
Code:
crontab -l > /backup/cron/cronjobs.bakup crontab -u username -l > /backup/cron/cronjobs_username.bakup
I hope to be useful.
by Eminem
Good luck
No comments:
Post a Comment