Hi,
Me and my team have been working in SAS now for 5 months.
And I would like assistance on how to clean-up our workspace storage and have this process automated.
We currently running our sas servers on an unix enviroment, and our workspace directory fills up pretty quickly which effects users.
What we find is that SAS doesn't always delete workspace files from sessions that are obsolete. So we need a non-manual way to delete these.
Someone in this community recommended we use a:cleanwork utility:
/sas/SASHome/SASFoundation/9.4/utilities/bin
I have not used this uitlity and we would like to know how we execute this command, and what are its effects?
I further would like recommndations on best practices on how to manage our workspace.
The easiest way to use cleanwork is to schedule it every 15 mins in cron under root on every compute server. The format is :
/sas/SASHome/SASFoundation/9.4/utilities/bin/cleanwork /my_work_folder_1
/sas/SASHome/SASFoundation/9.4/utilities/bin/cleanwork /my_work_folder_2
...etc
This is really all you need to keep you work directories clean. However, this doesn't prevent abuse of your workspace nor the cleanup of orphan processes. cleanwork only cleans up work folders that are not in use. If an orphan process is holding it, it's is seen as 'in use' by cleanwork.
The easiest way to use cleanwork is to schedule it every 15 mins in cron under root on every compute server. The format is :
/sas/SASHome/SASFoundation/9.4/utilities/bin/cleanwork /my_work_folder_1
/sas/SASHome/SASFoundation/9.4/utilities/bin/cleanwork /my_work_folder_2
...etc
This is really all you need to keep you work directories clean. However, this doesn't prevent abuse of your workspace nor the cleanup of orphan processes. cleanwork only cleans up work folders that are not in use. If an orphan process is holding it, it's is seen as 'in use' by cleanwork.
Thank you @nhvdwalt
This was a simple usage of the cleanwork utility and has worked. Are there any further recommendations you may have in regards to scheduling this tool to frequently execute every 30min?
If you want to run your cleanwork every 30 minutes, switch to the root account, run
crontab -e
and add the following line (since crontab -e uses vi, scroll to the last line, type A (capital a), and then <enter> for a new line):
5,35 * * * * /sas/SASHome/SASFoundation/9.4/utilities/bin/cleanwork your_work_dir >/dev/null 2>&1
hit <escape>, : (colon), x and <enter> to exit vi with writing the changed crontab; it will be active from then on.
The >/dev/null 2>&1 redirects all stdout and stderr output to the bit bucket; otherwise you'd get mails for every execution.
Another way to edit the crontab is this:
crontab -l > crontab
creates a file named "crontab" in the current directory. Edit that with an editor of your choice, and then run
crontab crontab
to create the new crontab entry from that file. Make sure that all existing entries are kept as-is.
Running cleanwork from root is necessary as the WORK directories will belong to different users, and only root can remove them all.
In addition to @nhvdwalt:
if you want to be proactive in managing shared resources, you will need to use filesystem quotas, so individual users can not use up all space and ruin the day for all others. This is true for all resources where users have been granted write access; you can omit it where small groups of users are involved (that can handle the management by themselves), and where the non-availability of a resource will not cause a business-critical problem.
In our case, that is the home filesystem, and all WORK/UTILLOC locations.
Could you please help me with the document about file system quotas to prevent the users from consuming all space?
Maxim 6: Google is your friend.
Do a search for "linux filesystem quotas", and you'll end up with a mountain of useful resources, the first being http://www.yolinux.com/TUTORIALS/LinuxTutorialQuotas.html.
The cleanwork utility is your way to go and others have already replied on how it works.
On a side note I would be interested in why your work grows so quickly. In the ideal situation, when SAS terminates in an intended fashion ( a user quits the SAS session; a SAS job end) the work library is deleted automatically. Any residual work locations are due to SAS sessions that end in a less fortunate way because they crash or are killed by some administrative action. If you have many of these this may require some investigation.
Start with checking the value of the WORKTERM option. By default it is WORKTERM; the opposite, NOWORKTERM, will cause your WORK libraries to persist. I have never seen that being the default but you never know. If WORKTERM is the default, dig deeper.
Regards,
- Jan.
The SAS Users Group for Administrators (SUGA) is open to all SAS administrators and architects who install, update, manage or maintain a SAS deployment.
SAS technical trainer Erin Winters shows you how to explore assets, create new data discovery agents, schedule data discovery agents, and much more.
Find more tutorials on the SAS Users YouTube channel.