Knowledge Base Glossary       Exit
(how to) Search  

Browse by Category
Knowledge Base > Archive > Products > IFD/IFL/IFW - Version 1 > How to run IFL commands from a cron job

How to run IFL commands from a cron job

Please note: This article applies to version 1 product(s) only.

Because the IFL program (imagel) is normally attached to a terminal, attempting to run an imagel command from a cron job will result in an error message such as "error opening terminal", and the command will fail to execute.

To successfully run an imagel command line from a cron job, it is necessary to add the line 'TERM=dumb' to the cron job file as shown in the following example:

TERM=dumb
# m  h  dom  mon  dow  user  command
30  5  *  *  *  root  /home/user/ifl/imagel  /c00x01vb  /mnt/debian   >  /dev/null

The above would cause cron to run this job at 5:30 AM every day as root. The redirection of the command's output to /dev/null is not required, but will prevent cron from sending an email containing the screen output of imagel each time the job runs. If you do want to receive email notification that the cron job was run, the following is an example of how that could be accomplished:

TERM=dumb
# m  h  dom  mon  dow  user  command
30  5  *  *  *  root  /home/user/ifl/imagel  /c00x01vb  /mnt/debian   >  /dev/null
30  5  *  *  *  root  /bin/echo "debian cron job has been executed"

If the cron job is calling a script, which in turn runs the imagel command(s), the script should include the line  'export TERM=dumb' before the imagel command(s) that you want to run. The following is an example script:

#! /bin/sh
export TERM=dumb
/home/user/ifl/imagel  /c00x01vb /mnt/debian  > /dev/null

Important: Attempting to image a partition that is currently mounted and writable is likely to result in a byte-for-byte validation error. This is due to the contents of the partition changing as the image is created. The validation failure is an  indication that the partition's file system may be in an inconsistent state when the image is restored. To successfully create and validate a reliable image, the partition should be unmounted prior to imaging. If that is not possible (such as for the root partition), the partition should be imaged from another Linux system such as the IFL boot disk.

In some cases, another option is to remount a partition as read only, create the image, and then remount the partition as read/write again. Remounting read only will not be possible in all cases, and you will typically get an eror message saying that the partition is busy when a remount fails. The mount commands to remount a partition are as follows:

mount  -o  remount,ro  /mnt           (remount partition at /mnt as read only)
mount  -o  remount,rw  /mnt          (remount partition at /mnt as read/write)

How helpful was this article to you?


powered by Lore