Changes

Jump to: navigation, search

OPS335 Lab 1

297 bytes added, 08:43, 14 January 2016
no edit summary
== Scheduling Tasks (Cron) ==
'''Cron ''' is a ''daemon - '' (i.e. a program that runs in the background). ItThe term ''"Cron"'' is short for Chronograph which is an old fashioned word for '''stop watch''' or '''timer'''s . The role of '''Cron''' is to run tasks periodically. It can run tasks for the system (as root) or for a user (any userincluding regular users). We'll get cron to run some backup scripts for us, but first let's see how it works.
You will get cron to run some backup scripts for vms for this course, but first, let's see how Cron works. Every user has a crontab - (Cron Table) which is a list of tasks they want to run periodically. You do not edit this file manually: instead, you edit this table using the command '''crontab -e'''. Once you run the command , you'll will get an empty file where you have to insert a line like this:
<pre>10 * * * * echo "Cron ran this job at: "`date` > /tmp/cron.log</pre>
This tells cron to run the command '''echo "Cron ran this job at: "`date` > /tmp/cron.log''' at the 10th minute of every hour of every day of every month.   '''Perform the following steps:'''  Modify the setting so it will run in a couple of minutes from now and insert that into your crontab.
Wait for the minute to pass, and check that /tmp/cron.log was created with the expected contents. You can also check /var/log/cron to see what jobs were run.
13,420
edits

Navigation menu