tw_cron_update
The tw_cron_update
utility is used to manage tideway user cron.
Warning
Do not use crontab -e
to edit the tideway user cron directly on the appliance.
To use the utility, type the following command at the $TIDEWAY/bin/
directory:
tw_cron_update
Cron overview
BMC Discovery makes use of cron on the appliance to run various housekeeping tasks. This means that crontab must not be directly edited on the appliance, but must instead be managed using tw_cron_update
. This way, BMC Discovery can manage cron entries across upgrades without affecting, or being affected by, any local customizations.
Cron entries are stored in $TIDEWAY/etc/cron
. Each cron entry has its own file, using the file extension .cron
to identify that file. A cron entry is created by adding a new file ending with .cron
containing standard cron formatted commands. Similarly entries can be edited or removed by editing or removing .cron
files.
$TIDEWAY/bin/tw_cron_update
checks, every time it is run, that the file has not been edited since tw_cron_update
was last run.
A note on the format of a cron entry is provided in the tw_cron.header
file:
#****************************************************************** # The Tideway crontab file should NOT be edited manually. # Please add or edit .cron files in $TIDEWAY/etc/cron and then run # $TIDEWAY/bin/tw_cron_update to update changes. # # crontab format: # min (0-59) hour (0-23) day(1-31) month(1-12) wkday(1-7) command # ex: 30 23 * * * rm /home/someuser/tmp/* #****************************************************************** MAILTO=""
For full details, see the Red Hat Enterprise Linux version 7 cron documentation as this applies equally to CentOS.
Note
If crontab has been directly edited, tw_cron_update
can no longer manage cron. You will have to manually resolve any differences before continuing. A copy of the expected cron configuration is stored as $TIDEWAY/etc/cron/tw_cron.previous
whenever tw_cron_update
is run. This can be compared to the live configuration. If this file does not exist, then the utility has never been used and crontab should be used as the default.
Managing cron entries
Cron entry files in $TIDEWAY/etc/cron
are applied to the live cron configuration by running $TIDEWAY/bin/tw_cron_update
as the tideway user.
- Run
$TIDEWAY/bin/tw_cron_update
as the tideway user. Every time the script is run it confirms that the current live cron configuration matches what BMC Discovery expects it to be. If the configuration is as expected, there will be no output. If there is a discrepency, an appropriate message will be displayed, and the discrepency must be resolved before continuing. To add a new cron entry, add a new
.cron
file. For example, the following file runs thetw_supportability
command daily at 23:45:[tideway@appliance01 cron]$ more tw_appliance_stats.cron # # cron job to capture disk and cpu daily usage # runs every day at 23:45 # 45 23 * * * /usr/tideway/bin/tw_supportability
- To remove a cron entry, remove its
.cron
file, or modify the file extension to something other than.cron
, (for example,.disabled
. - To modify a cron entry, edit its
.cron
file. - Run
$TIDEWAY/bin/tw_cron_update
as the tideway user.
Comments
Log in or register to comment.