KB Logo

TOLIS Group Knowledge Base

Browse KB by category:
Go to KB #:
Email   Bookmark

How do I use BRU with CRON?

Views: 12525
Votes: 2
Posted: 02 Oct, 2007

Using BRU with cron

One of the more convenient aspects of BRU is that it can be used in conjunction with cron to automatically perform tasks that don't require operator intervention. cron is an imbedded Unix utility through which one or more Unix commands can be scheduled to be executed at specific dates and times. cron operates by referencing a user-specified file that contains Unix commands and executions times or, if a file is not specified, by reading the standard input from the cron table (crontab). cron stores the crontab information in a directory and tasks are queued in the order they are scheduled. At the dates and times specified, Unix will grab the commands from the crontab file and execute them.

The basic procedure for using cron is to select a process (such as a BRU backup) that can be run automatically, then create or amend a crontab file reflecting the proper information and make certain that cron is correctly pointed at the file. The simplest way to amend the crontab is by adding an additional line to the file using the command sequence crontab -e. This will automatically open the file and allow for modification of the current number of entries. Figure 1.1 shows a breakdown of the typical cron entry format.

Figure 1.1

The resulting action of this cron entry will be an incremental backup that will run Monday-Thursday at 10:00 p.m. The first five fields shown control the scheduling of the Unix command (in this case a script), which is entered into field six. An asterisk is used in any of the five to represent all possibilities available for that field. All fields must either contain viable data or an asterisk for cron to operate properly. The key is as follows:

* = All Possibilities
N,N = Both Variables (5, 10)
N-N = Inclusive Variable (1-5)
/N = Every N of Element (*/5=Every five minutes) Some OSs do not support this.

The following examples further illustrate scheduling possibilities using only the first five fields of cron (minus the Unix command):

30 * * * * = 30 minutes after every hour
30 02 * * * = At 2:30 a.m. every morning
00 18 1 * * = 6 p.m. on the first of every month
45 23 * * 1-5 = 11:45 p.m. Mon.-Fri.
00 06 1 1,7 * = First day of the month of Jan. & July at 6 a.m.

Once jobs have been scheduled in crontab, an active file will look similar to this:

Figure 1.2

Figure 1.2 shows the command sequence from Figure 1.1 as the newest entry (bottom line). Now that this operation has been added, Unix will execute it based on the parameters identified in the cron entry. Because the Unix command specified refers to a script, Unix will perform the functions identified within the script itself. Practically any user-selected script can be referred to in the cron entry as long as it contains operations that can be performed automatically. Whereas cron is merely the task scheduler, the actual scripting can encompass a broad expanse of functionality. See the BRU User's Guide for further information regarding advanced uses of BRU with cron, or see the system man pages for more specific information on cron and crontab.

By utilizing BRU with cron, an operator or administrator has the ability to run defined backups with or without intervention at any time, especially times when the system is either inactive or at least outside of its peak operation. As long as the scheduled definitions are accurate, and the hardware that is required is configured properly, BRU's effective use of the cron feature is just one facet of the flexibility that makes BRU an efficient and effective administration tool.

Others in this Category
document Important changes made to the 'bruxpat' file declaration in version and higher.
document Setting up an Autoloader to work with BRU - Method 1
document How do you configure the scheduler with XBRU?
document Is it possible to use BRU to copy data between systems?
document How to use BRU with Autoloaders
» More Articles

Powered by KnowledgebasePublisher
Page Load Time: 0.03156 seconds / 31.56 milliseconds.
Page File Size: 25130 bytes.