OpenText product name changes coming to the community soon! Learn more.

Wikis - Page

Auto-Generate Time Periods

0 Likes

ISSUE: HOW TO STEPS:

We recently had an issue where we forgot to manually run kGenTimeMgmtPeriods.sh and, come one Monday, no one was able to create new time sheets until this was executed. 

To prevent this from happening in future, I created a short script to call the 'Generate Time Periods' job and added it to the crontab. It was a little trickier than I thought because of the prompts that job has but, after some trial and error, the below script works great:

      # /home/ppmprd/GenerateTimePeriods.sh - Script to call the Generate Time Periods job 

      exec > /home/ppmprd/GenTimePer_out.txt
      exec 2>&1

      cd /opt/ppm/bin

      . ./kVariables.sh

      (echo y
      sleep 30
      echo 1
      ) | ./kGenTimeMgmtPeriods.sh

I then added the following two lines to the crontab:

0 0 1 */3 * /home/ppmprd/GenerateTimePeriods.sh > /dev/null 2>&1

5 0 1 */3 * echo "Please see the attached script output. This job generates 24 time periods (weeks) and runs quarterly (Jan 1, April 1, July 1 and October 1). Because of this, some overlap occurs; this is harmless and should be ignored." | mail -a /home/ppmprd/GenTimePer_out.txt -s "PPM Generate Time Periods Completed" address@email.com

Just thought that I would share in case anyone else was interested. Thanks.


Comment List
Related
Recommended