Author Topic: Job to delete out files in the /tmp directory  (Read 1402 times)

chuckalugk

  • Jr. Member
  • **
  • Posts: 23
    • View Profile
Job to delete out files in the /tmp directory
« on: December 04, 2020, 09:49:29 AM »
Does anyone have a job they can share that deletes out the files in a /tmp directory in USS?   I found my /tmp directory had 5900 files in it.

Justin Derrick

  • IBM Content Manager OnDemand Consultant
  • Administrator
  • Hero Member
  • *****
  • Posts: 2229
  • CMOD Guru for hire...
    • View Profile
    • Tenacious Consulting
Re: Job to delete out files in the /tmp directory
« Reply #1 on: December 06, 2020, 02:27:24 PM »
If you have unix-style commands available to you, and the cron scheduling tool, you can configure cron to run this command daily, which deletes files that were created x days ago:

find /tmp/ -name FILESPEC -ctime +x rm -f {} \;

PLEASE BE EXTRAORDINARILY CAUTIOUS WITH THIS COMMAND, AS IT FORCES FILES TO BE DELETED. 

Set FILESPEC to the file specification you want to use ("*.AOD") and 'x' to the number of days you want files to exist.

-JD.
IBM CMOD Professional Services: http://TenaciousConsulting.com
Call:  +1-866-533-7742  or  eMail:  jd@justinderrick.com
IBM CMOD Wiki:  https://CMOD.wiki/
FREE IBM CMOD Education & Webinars:  https://CMOD.Training/

Interests: #AIX #Linux #Multiplatforms #DB2 #TSM #SP #Performance #Security #Audits #Customizing #Availability #HA #DR

rjchavez

  • Jr. Member
  • **
  • Posts: 67
    • View Profile
Re: Job to delete out files in the /tmp directory
« Reply #2 on: December 18, 2020, 09:13:04 AM »
We have a CRON job/command that performs clanup automatically for any file older than 7-days (-mtime +7). 

0 0 * * * find /tmp/ -type f -mtime +7 -exec rm -v {} \; > /tmp/tmp_rm.txt &