8.3.9 adshhk command (deletes spool jobs)
Syntax
adshhk target-list-file-name report-file-name log-file-name [number-of-days]
Description
This command deletes spool jobs from the spool directories identified in the list file specified in target-list-file-name. The execution results are output in CSV format to the file specified in report-file-name. Messages output during execution, such as error messages, are output to the file specified in log-file-name.
This command and the adshevtout command apply exclusive control over spool directories. If the adshhk command is unable to obtain a lock on a spool directory, it skips processing of that spool directory and outputs the KNAX4425-E message.
Arguments
- target-list-file-name
Specifies the file name of the file that specifies the spool directories that contain spool jobs that are to be targets for deletion. You specify in advance in the target list file the names of the spool root directories containing the spool directories to be deleted and for each a number-of-days value. Spool jobs that were executed more than the specified number of days prior (the count begins from the day before the adshhk command was executed) are deleted from the specified spool directory.
The target list file can contain multiple lines in text file format. A line cannot exceed 4,095 bytes, counting from the beginning of the line through the end-of-line code at the end. The values must be enclosed in double quotation marks (").
The format of the target list file is:
"spool-root-directory-name"[,"number-of-days"]
The following explains each item.
- spool-root-directory-name ~<path name>((1 to 128 bytes))
Specifies the name of a spool root directory whose spool jobs are candidates for deletion. Specifying the full path is recommended.
- number-of-days ~<unsigned integer>((1 to 999))
Specifies a days-count value to be used to determine the spool jobs to be deleted from the spool directory. The spool job directory of batch jobs that were executed more than the specified number of days prior (the count begins from the day before the adshhk command was executed) are deleted. If this value is omitted in the list file for a spool directory, the value specified in the number-of-days argument in the adshhk command is used. If no number-of-days value is specified in the file or in the command argument, the line generates an error, but subsequent lines are processed.
Specifying "" is same as omitting the number-of-days specification.
- report-file-name
Specifies the name of the output file for the execution results. The report file is output in CSV format. If the specified file does not exist, it is created. If it already exists, its existing contents are overwritten.
The report file access permissions are set as follows:
Windows: According to the settings for the output folder.
UNIX: 600
For an example of a report file's output, see 3.9 Deleting spool jobs.
- log-file-name
Specifies the name of the output file for error messages and other messages. If the specified file does not exist, it is created. If it already exists, its existing contents are overwritten.
The log file access permissions are set as follows:
Windows: According to the settings for the output folder.
UNIX: 600
- number-of-days ~<unsigned integer>((1 to 999))
Specifies a days-count value to be used to determine the spool jobs to be deleted from the spool directories. The spool job directory of batch jobs that were executed more than the specified number of days prior (the count begins from the day before the adshhk command was executed) are deleted. This argument takes precedence over the number-of-days values specified in the target list file. When this argument is omitted, the number-of-days values specified in target list file are used. If you omit this argument, you must specify number-of-days values in the target list file.
Return codes
Return code |
Meaning |
---|---|
0 |
Normal termination |
1 |
Error termination |
2 |
Deletion failed because a spool directory is being used by another program (the return code might be other than 2 if other errors occurred). |
253 |
Error in standard error output |
Notes
The only spool jobs subject to deletion are those for which the user who executes the command has deletion permissions. A failure to delete will be reported for spool jobs for which deletion permissions are lacking. If you want to delete the spool jobs of all users, you must execute the deletion as a user who has deletion permissions for all spool jobs.
Files created under a spool job directory for which the user has deletion permissions are deleted regardless of whether they were created as batch jobs.
Subdirectories created under a spool job directory might not be deletable.
If a job's execution start date is unknown, deletion will not be performed (this will be treated as an error).
The only spool jobs that are deleted are those whose spool job directories are in the format job-ID-spool-job-name or job-ID-. When a spool job directory is missing the hyphen (-) following the job ID, it indicates that the batch job is still running, it was terminated improperly by means other than one described in 3.11.1 How to forcibly terminate jobs, or some similar situation. Such directories are never deleted, regardless of the actual state of affairs.
If an error occurs during deletion, deletion processing on the affected spool job might be in a partially completed state.
Results are not output to the report file in number order. If necessary, a sort program can be used to sort them.
No deletions will be performed in a specified spool directory that is being processed by the adshevtout command (which outputs job definition script operation information).
Because spool jobs to be deleted are deleted from the spool job management file, if deletion processing is interrupted, they might not be deleted even if you re-run the adshhk command. In such a case, you must delete manually any spool jobs that failed to be deleted.
To manually delete a spool job that the adshhk command failed to delete, use a command such as rm -r to delete both the spool job directory and all the files within the directory. When you do so, use the creation date of the spool job directory and of the files contained in the directory to check whether the job has completely finished. We recommend that you stop operations such as batch jobs before deleting the directory and files.
Example
Delete the following batch jobs:
Batch jobs in the /home/user001/jp1as/spool directory that ran more than seven days ago
Batch jobs in the /home/user999/jp1as/spool directory that ran more than 30 days ago
Specify the following information in advance in target list file /home/kanrisya/hk/target:
"/home/user001/jp1as/spool","7" "/home/user999/jp1as/spool","30"
In this case, execute the command shown below. The report is stored in the /home/kanrisya/hk/result.csv file.
adshhk /home/kanrisya/hk/target /home/kanrisya/hk/result.csv /home/kanrisya/hk/result.log
For an example of a report that is created, see 3.9 Deleting spool jobs.