{"id":342,"date":"2008-03-10T20:16:00","date_gmt":"2008-03-11T03:16:00","guid":{"rendered":"https:\/\/kb.terabyteunlimited.com\/kb-articles\/how-to-run-ifl-commands-from-a-cron-job-2\/"},"modified":"2021-09-06T23:09:31","modified_gmt":"2021-09-07T06:09:31","slug":"how-to-run-ifl-commands-from-a-cron-job-2","status":"publish","type":"lsvr_kba","link":"https:\/\/www.terabyteunlimited.com\/kb\/kb-articles\/how-to-run-ifl-commands-from-a-cron-job-2\/","title":{"rendered":"How to run IFL commands from a cron job"},"content":{"rendered":"<p>\r\n<strong>Please note: <\/strong>This article applies to version 1 product(s) only.<\/p>\r\nBecause the IFL program (imagel) is normally attached to a terminal,\r\nattempting to run an imagel command from a cron job will result in an\r\nerror message such as <strong>&quot;error opening terminal&quot;<\/strong>, and the command will fail to execute.<br \/><br \/>To\r\nsuccessfully run an imagel command line from a cron job, it is\r\nnecessary to add the line 'TERM=dumb' to the cron job file as shown in\r\nthe following example:<br \/><br \/>TERM=dumb<br \/># m&nbsp; h&nbsp; dom&nbsp; mon&nbsp; dow&nbsp; user&nbsp; command<br \/>30&nbsp; 5&nbsp; *&nbsp; *&nbsp; *&nbsp; root&nbsp; \/home\/user\/ifl\/imagel&nbsp; \/c00x01vb&nbsp; \/mnt\/debian&nbsp;&nbsp; &gt;&nbsp; \/dev\/null<br \/><br \/>The\r\nabove would cause cron to run this job at 5:30 AM every day as root.\r\nThe redirection of the command's output to \/dev\/null is not required,\r\nbut will prevent cron from sending an email containing the screen\r\noutput of imagel each time the job runs. If you do want to receive\r\nemail notification that the cron job was run, the following is an\r\nexample of how that could be accomplished:<br \/><br \/>TERM=dumb<br \/> # m&nbsp; h&nbsp; dom&nbsp; mon&nbsp; dow&nbsp; user&nbsp; command<br \/> 30&nbsp; 5&nbsp; *&nbsp; *&nbsp; *&nbsp; root&nbsp; \/home\/user\/ifl\/imagel&nbsp; \/c00x01vb&nbsp; \/mnt\/debian&nbsp;&nbsp; &gt;&nbsp; \/dev\/null<br \/> 30&nbsp; 5&nbsp; *&nbsp; *&nbsp; *&nbsp; root&nbsp; \/bin\/echo &quot;debian cron job has been executed&quot;<br \/><br \/>If the cron job is calling a <strong>script<\/strong>,\r\nwhich in turn runs the imagel command(s), the script should include the\r\nline&nbsp; 'export TERM=dumb' before the imagel command(s) that you want to\r\nrun. The following is an example script:<br \/><br \/>#! \/bin\/sh<br \/>export TERM=dumb<br \/>\/home\/user\/ifl\/imagel&nbsp; \/c00x01vb \/mnt\/debian&nbsp; &gt; \/dev\/null<br \/><br \/><strong>Important:<\/strong>\r\nAttempting to image a partition that is currently mounted and writable\r\nis likely to result in a byte-for-byte validation error. This is due to\r\nthe contents of the partition changing as the image is created. The\r\nvalidation failure is an&nbsp; indication that the partition's file system\r\nmay be in an inconsistent state when the image is restored. To\r\nsuccessfully create and validate a reliable image, the partition should\r\nbe unmounted prior to imaging. If that is not possible (such as for the\r\nroot partition), the partition should be imaged from another Linux\r\nsystem such as the IFL boot disk. <br \/><br \/>In some cases, another\r\noption is to remount a partition as read only, create the image, and\r\nthen remount the partition as read\/write again. Remounting read only\r\nwill not be possible in all cases, and you will typically get an eror\r\nmessage saying that the partition is busy when a remount fails. The\r\nmount commands to remount a partition are as follows:<br \/><br \/>mount&nbsp; -o&nbsp; remount,ro&nbsp; \/mnt&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; (remount partition at \/mnt as read only)<br \/>mount&nbsp; -o&nbsp; remount,rw&nbsp; \/mnt&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; (remount partition at \/mnt as read\/write)<br \/>","protected":false},"excerpt":{"rendered":"<p>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 &quot;error opening terminal&quot;, and the command will fail to execute.To successfully run an imagel command line [&hellip;]<\/p>\n","protected":false},"author":5,"featured_media":0,"comment_status":"closed","ping_status":"closed","template":"","meta":{"footnotes":""},"lsvr_kba_cat":[1818],"lsvr_kba_tag":[2118],"class_list":["post-342","lsvr_kba","type-lsvr_kba","status-publish","hentry","lsvr_kba_cat-ifd-ifl-ifw-version-1-archive","lsvr_kba_tag-archived"],"_links":{"self":[{"href":"https:\/\/www.terabyteunlimited.com\/kb\/wp-json\/wp\/v2\/lsvr_kba\/342","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.terabyteunlimited.com\/kb\/wp-json\/wp\/v2\/lsvr_kba"}],"about":[{"href":"https:\/\/www.terabyteunlimited.com\/kb\/wp-json\/wp\/v2\/types\/lsvr_kba"}],"author":[{"embeddable":true,"href":"https:\/\/www.terabyteunlimited.com\/kb\/wp-json\/wp\/v2\/users\/5"}],"replies":[{"embeddable":true,"href":"https:\/\/www.terabyteunlimited.com\/kb\/wp-json\/wp\/v2\/comments?post=342"}],"version-history":[{"count":1,"href":"https:\/\/www.terabyteunlimited.com\/kb\/wp-json\/wp\/v2\/lsvr_kba\/342\/revisions"}],"predecessor-version":[{"id":5963,"href":"https:\/\/www.terabyteunlimited.com\/kb\/wp-json\/wp\/v2\/lsvr_kba\/342\/revisions\/5963"}],"wp:attachment":[{"href":"https:\/\/www.terabyteunlimited.com\/kb\/wp-json\/wp\/v2\/media?parent=342"}],"wp:term":[{"taxonomy":"lsvr_kba_cat","embeddable":true,"href":"https:\/\/www.terabyteunlimited.com\/kb\/wp-json\/wp\/v2\/lsvr_kba_cat?post=342"},{"taxonomy":"lsvr_kba_tag","embeddable":true,"href":"https:\/\/www.terabyteunlimited.com\/kb\/wp-json\/wp\/v2\/lsvr_kba_tag?post=342"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}