Setting up the CRON Job

When setting up the policy cron job it is probably easiest to set up a simple shell script to wrap the policy so that the processing environment is set up correctly. For example, set up a script under TSM: /usr/adic/TSM/util/truncPolicy

The contents of the script may look like:

#!/bin/sh

#

. /usr/adic/.profile

/usr/adic/TSM/exec/fspolicy -t -c class1 -o 0

Note: The last argument to the policy command '-o 0'. This tells the policy to keep truncating files until it runs out of candidates or the file system reaches 0% full. The filesystems(4) man page indicates the automatic nightly policy only truncates to the Min Use percentage and then quits even if more valid candidates are present. If the desire is to truncate all candidates, the '-o 0' is needed. Truncating all files for a class should be done carefully as there will be an expense to retrieving those files back if needed.

StorNext allows running only one truncation policy at a time. This is due to potential conflicts in candidate management between policies, and also for performance reasons. If you want to run multiple policies “at the same time,” put multiple policies in the truncate script and have them run sequentially.

Be sure to avoid placing an ampersand after the commands, as some will fail because they are locked out by the currently running policy. Also be sure when setting up the cron jobs not to have the scheduled scripts run too closely together. See Considerations When Scheduling Truncation and Relocation Policies for more considerations on scheduling truncation policies.

Following is an example of a script with multiple scheduled policies:

#!/bin/sh

#

. /usr/adic/.profile

/usr/adic/TSM/exec/fspolicy -t -c class1 -o 0

/usr/adic/TSM/exec/fspolicy -t -c class2 -o 0

/usr/adic/TSM/exec/fspolicy -t -c class3 -o 0

The next step is to create the actual cron entry. Run crontab -e and set the entry to look something like this:

00,30 * * * * /usr/adic/TSM/util/truncPolicy

One last thing to note on scheduling 'extra' truncation or relocation policies: There is an expense to running these commands as they get and check their candidate lists, even if no files are actually truncated or relocated. This is especially true for sites where millions of files are resident on disk at one time.

What Happens If the Old Script is Still Running?

The fspolicy commands placed in the script have code internally that checks for truncation policies which are already running. If a second truncation policy runs while one is active, that fact will be recognized by the new policy and it will abort reporting a truncation policy is already in progress.

This is true regardless of whether the policy was started by hand, cron job, etc. So in summary, the new script will exit immediately without doing anything.

Note: For this reason, if you want to run multiple truncation policies ‘at the same time,’ Quantum recommends creating one script with the desired policies running sequentially and then adding that script to cron.

How Can I Tell How Long the Script Has Taken to Run?

Each TSM command logs output to the history log located at /usr/adic/TSM/logs/history/hist_01 as it runs. This includes time stamps of when the command started and completed. It is possible by parsing this log to determine how much time the truncation policies are using.