Официален блог на WebEKM EKM очаквайте сайта онлайн скоро.

Download Free Templates http://bigtheme.net/ free full Wordpress, Joomla, Mgento - premium themes.

Crontab and NTP – jobs automation, scheduling and time services

crontab small 234Crone and NTP (network time protocol) services are to some extent linked with each other despite they do completely different things. Crone is responsible for automating of processes, NTP for keeping time on our server up to date, but correct work of Crone is dependant on correct work of NTP.

Crone stands for Command Run ON CRON in plain words enables us scheduling tasks. If we want any scripts run in particular time and date, we don’t have to do that manually and be present at a server, the Crone daemon will do that for us. 

Crone can be run in 3 ways:
1 Placing script in one of the folders in /etc :cron.hourly , cron.daily , cron.monthly, cron. weekly.  Then scripts are being run with root previliges. We don’t have to create any crontab files. Files that have been put into particular folder will be executed automatically according to the time.

2 /etc/crontab – specifies what job given user is going to run.

3 crontab job
 

I added a simple job every 1 minute the system will list /etc folder and redirect the output to the file.txt

How do we specify the time of the job ?

Below table gives you a couple of examples 

croneexplanation
 

/etc/ cron.d/ – the folder contains files that will be executed via crontab, created by package management and owned by the system, users should use crontab file instead of cron.d

cron security files (who is able to run cron jobs)
/etc/cron.allow – user allowed
/etc/cron.deny – user not allowed, if there is a cron.allow file, then user.deny makes no sense, becasue the remained users will be blocked

3 personal crontab – creted by user
crontab -e – command that open a file with cron jobs

crontab -l – listing of cron jobs

 *  *  *  *  *  /usr/local/bin/executed_program

Time Services

hwclock  – shows actual clock

/etc/ntp/step-tickers – the file in which we define time servers used by ntpdate service

NTP on CentOS

In order to run Cron jobs at accurate time we need an accurate time on the server. By installing NTP we can be sure that the time on the server will be the most accurate all the time.

ntpd – process that keeps the time accurate and synchronized with a time server

Firstly we havet to install two packages ntp and ntpdate

yum install ntp ntpdate

Now we have to point out the ntp server that our server will be using to synchronize a time

ntpdate [time.server] ip address or fqdn pool.ntp.org

and we have to start ntpd service

service ntpd start

ntp pool

,

Onlain bookmaker bet365.com - the best bokie

Menu