Admin Alert: Running System i Cleanup Manually
May 18, 2011 Joe Hertvik
A reader recently wrote me inquiring about some of the finer points in running the i operating system’s cleanup tasks for clearing out messages, job logs, and other system output. While IBM offers a decent automated cleanup function, it’s not quite as clear how to manually run the cleanup option. This week, I’ll review what cleanup tasks do and show you how to run this function either automatically or manually.
What Are the Cleanup Tasks?
Cleanup is an i operating system task for manually or automatically cleaning up user messages; system and workstation messages; system journals, job logs and log files; and other system output. Many administrators automatically run the cleanup jobs every night but the jobs can also be run manually or inside an automated job scheduler. To view the cleanup task options on your system, bring up the Cleanup Tasks menu by typing in the following Go to Menu (GO) command on a green screen command line.
You’ll see a screen that looks something like this.
Select option 1, Change Cleanup Options, and you’ll see the following Change Cleanup Options screen.
The cleanup options are fairly straightforward. If you want the system to automatically run cleanup every night, put a ‘Y’ in the allow automatic cleanup option and specify the time you want the cleanup jobs to run. The rest of the options deal with how many days worth of each type of system output you want to keep after cleanup completes (i.e., user and system messages, job logs, spooled file output, etc.). If you opt for automatic cleanup, the cleanup job will run every night.
What’s Wrong With Automatically Running Cleanup?
Unfortunately, because of nightly schedules, backups, system traffic, or other issues, not everyone wants to run system cleanup every night. And there isn’t any system option to run cleanup on a staggered schedule where it runs at different times each night or executes as a reactive job that runs after another job completes.
To change the cleanup tasks to run on a different schedule, you have two choices:
1. You can start the cleanup job manually. Or. . .
2. You can insert the cleanup tasks into your job scheduler to run either as a scheduled job on certain nights of the week or as a reactive job after a critical companion job such as a nightly backup finishes.
Here’s the lowdown on how to run either option.
The Key To Running Cleanup Manually or Inside a Job Scheduler
You can run cleanup tasks manually by executing the following Start Cleanup (STRCLNUP) command on a command line.
However, if your system is already set to run system cleanup automatically each night, you may receive the following message.
Cleanup has already been started or is scheduled to run.
And the command will not run. In order to run the STRCLNUP command manually or in a job scheduler, you have to configure your cleanup options in a specific way. To do this, go into option 1, Change Cleanup Options, on the Cleanup Tasks menu and make the following changes.
After these parameters are set correctly, you will be able to run STRCLNUP manually by executing STRCLNUP from a command line or inside a job scheduler entry.
Running STRCLNUP From Your Job Scheduler
After you make the changes that allow STRCLNUP to manually run, you will then be able to run it from a job scheduler such as IBM’s job scheduler or Help/Systems‘ Robot/SCHEDULE. The reason you might want to use a job scheduler instead of the automatic cleanup function is that you may not want cleanup to run at the same time every night. Some nights, you may want to run it at 10 p.m., on Sunday mornings you may want to run at 3 a.m., and on other nights you may not want to run it at all. You can’t do that with the automated cleanup schedule, which runs it at the same time every day. For that, you have to turn to a scheduling program.
The first step is to add an entry to your job scheduler for the days you want cleanup to run. Set up your scheduler entry so that it submits the STRCLNUP command as shown here.
Once you set up your entry, cleanup will run according to the schedule you’ve created.
However, if you want cleanup to run as a reactive job that only runs after another job finishes, you have two choices.
1. If you’re running Robot/SCHEDULE, you can designate it as a reactive job. SCHEDULE has a reactive job function where your job will be submitted only after its designated companion job completes.
2. If you don’t have reactive job capability in your scheduler, you can set up your job entry to submit both the cleanup job and the reactive job to a single-threaded job queue. A single-threaded queue will only run one job at a time. So if you submit the companion job first to the queue followed by the cleanup job, the cleanup job will not run until the companion job finishes executing, which is exactly what a reactive job does when it waits for its companion job to complete before starting.
But there is one other trick to sending your cleanup job to a specific single threaded job queue. By default, i operating system cleanup jobs run in the QCTL job queue, which feeds into the QCTL subsystem. For some strange reason, this job queue is not changeable through option 1 (Change Cleanup Options) on the Cleanup Tasks menu. Rather, you need to use the Change Cleanup (CHGCLNUP) command as follows to change the job queue that your system cleanup jobs are submitted to.
On this screen, change the job queue and library name parameters to the single-threaded job queue that you want to submit your cleanup jobs to. By doing this, you are enabling your cleanup tasks to run immediately after its companion job finishes, creating a reactive job situation.
And that’s how you set up your operating system cleanup tasks to run automatically inside your job scheduler software on a staggered schedule or as a reactive job.
Correction: When Do SMTP Server Changes Take Effect?
In a recent article on configuring SMTP retry parameters, I mentioned that SMTP server parameter changes take effect immediately. That was a wrong statement. Reader Rich Grega wrote in to remind me that any SMTP server changes take effect the next time the server is started. So take note to restart your SMTP server after changing any parameters.
You can restart SMTP from the green screen by using the following green screen End TCP/IP Server (ENDTCPSVR) and Start TCP/IP Server (STRTCPSVR) commands.
ENDTCPSVR SERVER(*SMTP) STRTCPSVR SERVER(*SMTP)
To restart SMTP in System i Navigator (OpsNav), open the Network→Servers→TCP/IP node. In the right-hand pane that appears, right-click on the SMTP entry and click stop from the pop-up menu that appears. After the server status changes to stopped, right-click on the SMTP entry and this time click start from the pop-up menu.
Your changes will become active after the server restarts, as Rich noted.