OSG Cleanup Scripts

About this Document

Here we describe how to install and configure the OSG Cleanup Scripts on your Linux machine. This document is intended for site administrators who want to clean up Globus files that build up over time on a Compute Element.

About the Software

The cleanup script located at /usr/sbin/osg-cleanup is run by the cron daemon on the user's behalf. The default scripts that ship with it will clean up various Globus files and directories that are left behind. It is possible to add custom scripts (see below) to do cleanup specific to your site.

The following files and directories in users' home directories will be cleaned. Note that the locations of these can be overriden (see here for details):

  • Globus state directory: /var/lib/globus/gram_job_state
  • User gass cache <user home>/.globus/.gass_cache
  • User Globus job directory (old) <user home>/.globus/job
  • User Globus job directory (new) <user home>/.globus/<user name>/.globus/job
  • User GRAM job manager logs <user home>/gram_job_mgr_<integer>.log
  • User GRAM scratch directories <user home>/gram_scratch_<random string>
  • Globus Scheduler Event Generator logs /var/lib/globus/globus-seg-*/*


The cleanup scripts are provided by the osg-cleanup RPM and are installed as part of the Compute Element Installation.

osg-configure can be used to customize the behavior of the cleanup scripts, if desired. The configuration settings that osg-configure uses for the cleanup scripts can be found in /etc/osg/config.d/10-misc.ini. It is not necessary to modify them unless you want to customize the behavior of the cleanup scripts. The defaults are reasonable for most sites, with the following caveat:


If your site expects to have jobs that run for longer than 14 days, you must customize the cleanup_age_in_days variable. A limitation of osg-cleanup is that it does not detect whether or not the Globus temporary files it cleans up are in use. If a temporary file used by a running job gets removed, that job might be killed. Set the value of the cleanup_age_in_days variable to a number of days higher than you expect your long running jobs to complete. If for some reason this is not possible (for example, if the maximum runtime of a job is unbounded), do not use the osg-cleanup script.

; The OSG cleanup scripts are provided to help remove Globus files that                         
; build up over time on your system.  For more information see the Twiki:                       
;  https://twiki.grid.iu.edu/bin/view/Documentation/Release3/InstallCleanupScripts              

; The age in days after which files that have not been accessed should be                       
; deleted. Jobs that run longer than this number of days may be killed because                  
; necessary files may be removed.  If this is a problem for you do not run the                  
; osg-cleanup scripts and email vdt-support@opensciencegrid.org                                 
; Default = 14                                                                                  
;cleanup_age_in_days = 14                                                                       

; The user's home directories that should be cleaned up.  The default value                     
; is @vo-file.  This will open osg-user-vo-map.txt and try to get the list                      
; of users from this file.  Alternatively you can specify a whitespace                          
; separated list of users.                                                                      
;cleanup_users_list = @vo-file                                                                  

; The cron time at which the cleanup script will run.  By default it will run                   
; once a day during the night.                                                                  
;cleanup_cron_time = 15 1 * * *                                    

Starting OSG Cleanup Scripts

Run this command to enable the osg-cleanup cron job:

[root@client ~]$ /sbin/service osg-cleanup-cron start
Run this command to enable the osg-cleanup cron job on reboot:
[root@client ~]$ /sbin/chkconfig osg-cleanup-cron on

Stopping OSG Cleanup Scripts

Run this command to stop the osg-cleanup cron job:

[root@client ~]$ /sbin/service osg-cleanup-cron stop
Run this command to disable the osg-cleanup cron job on reboot:
[root@client ~]$ /sbin/chkconfig osg-cleanup-cron off

Advanced Topic: Adding Custom Cleanup Scripts

The cron job automatically executes all scripts found in /usr/libexec/osg-cleanup directory that are:

  • owned by root
  • permissions set to 0700

The following environment variables are available to all children cleanup scripts:

Variable Comment
$OSG_CLEANUP_AGE Age in days after which files will be deleted.
$OSG_CLEANUP_USER_FILE Path to a file containing a list of user accounts and home directories to clean up. The format is: <user> <user home>

Validation of Service Operation

  1. Verify that the log file /var/log/osg/osg-cleanup.log has been created and inspect its contents.
  2. Run the cleanup script /usr/sbin/osg-cleanup with the --dry-run option and inspect the output
[root@client ~]$ /usr/sbin/osg-cleanup --dry-run

Known Issues

The --dry-run option causes the scripts in /usr/libexec/osg-cleanup to not be run, decreasing its ability to validate the operation. See the JIRA ticket SOFTWARE-829 for details.

The scripts do not clean up custom user directories listed in RVF files. See the JIRA ticket SOFTWARE-828 for details.

Topic revision: r14 - 06 Dec 2016 - 18:12:41 - KyleGross
Hello, TWikiGuest!


TWiki | Report Bugs | Privacy Policy

This site is powered by the TWiki collaboration platformCopyright by the contributing authors. All material on this collaboration platform is the property of the contributing authors..