IBM Support

Scheduling cron jobs on the Virtual I/O Server

Question & Answer


Question

How to use cron to automate vital operations on PowerVM Virtual I/O Server

Cause

Need to schedule VIOS cron jobs.

Answer

The crontab command is available with the Virtual I/O Server (VIOS) to enable you to submit, edit, list, or remove cron jobs.  A cron job is a command run by the cron daemon at regularly scheduled intervals such as system tasks, nightly security checks, analysis reports, and backups.
With the VIOS, a cron job can be submitted by specifying the crontab command with the -e flag, as padmin user.  This is the same as running 'crontab -e padmin'.
By default, padmin user does not have a crontab file. "crontab -e" invokes an editing session in vi mode that enables you to create or modify the padmin users' crontab file and create entries for each cron job in this file using the entry format outlined in crontab command. Example: Scheduling backups of the Virtual I/O Server and user-defined virtual devices by creating a script and crontab file entry.
Note: When scheduling jobs, use the padmin user’s crontab file.   You cannot create or edit other users’ crontab files.
When you finish creating entries and exit the file, the crontab command copies it into the /var/spool/cron/crontabs directory and places it in the padmin file.
The following syntax is available to the crontab command:
crontab [ -e padmin | -l padmin | -r padmin | -v padmin ]

-e padmin     Edits a copy of the padmin’s crontab file. When editing is complete, the file is copied into the crontab directory as the padmin's crontab file.
-l padmin     Lists padmin's crontab file.
-r padmin     Removes the padmins crontab file from the crontab directory.
-v padmin     Lists the status of the padmin's cron jobs
To Remove a Cron Job
As padmin, run 'crontab -e'  and using vi editor, remove the desired cron job.  Bear in mind you will be in vi mode, so you have to adhere to the vi editor.
To delete the job, simply moving the cursor to the cron job line you wish to delete using the down arrow key, then hit the "d" key twice to delete the line.
Last, save the changes and exit by typing:
:wq
and hit <Enter>

Related Information

[{"Business Unit":{"code":"BU058","label":"IBM Infrastructure w\/TPS"},"Product":{"code":"SSPHKW","label":"PowerVM Virtual I\/O Server"},"Component":"","Platform":[{"code":"PF002","label":"AIX"}],"Version":"VIOS 2.2","Edition":"","Line of Business":{"code":"LOB57","label":"Power"}}]

Document Information

Modified date:
20 October 2021

UID

ibm10878983