|
|
You could use the build class and follow the approach shown for editing /etc/inittab in case study 5c except that you want to edit more than one file. If you used the build class approach, you would need to deliver one for each crontab file edited. Defining a cron class provides a more general approach. To edit a crontab file with this approach, you must:
Create an entry in the prototype(F) file for each crontab file which will be edited. Define their class as cron and their file type as e. Use the actual name of the file to be edited, as shown in the example.
These files contain the information you want added to the existing crontab files of the same name. See the sample root and sys files for two examples.
The i.cron script performs the following procedures:
This is done by setting the variable user to the base name of the cron class file being processed. That name equates to the user ID. For example, the basename of /var/spool/cron/crontabs/root is root (which is also the user ID).
Using the -l options tells crontab to send the standard output the contents of the crontab for the defined user.
The sample removal script is the same as the installation script except that there is no procedure to add information to the crontab file.
These procedures are performed for every file in the cron class.