BookmarkSubscribeRSS Feed
shlomiohana
Obsidian | Level 7
Hello,
I wrote a short script whose purpose to use cleanwork to delete temporary files from the disk.

#! /bin/sh
SERVER=`hostname -s`
start_date_tm=$(date +'%Y-%m-%d_%H:%M:%S')

/opt/sas/install/SASHome/SASFoundation/9.4/utilities/bin/cleanwork /saswork1 -n -v -hostmatch -log /opt/sas/system_logs/cleanwork_log/cleanwork_${SERVER}_${start_date_tm}.log

When I ran the script with root user on the server, I received the error:
/opt/sas/system_logs/cleanwork_log/cleanwork_sas04_2026-01-29_15:01:16.log : No such file or directory

I checked and all the folders were created before running the script.

My goal in the first stage is to have all the files that are supposed to be deleted recorded in the log file because of using the -n option.

I would appreciate guidance on what needs to be changed.
5 REPLIES 5
Kurt_Bremser
Super User

Your script tries to write the log to this path:

/opt/sas/system_logs/cleanwork_log/

but the system then complains about writing to this path:

/opt/sas/system_logs/

without the sub-directory cleanwork_log.

Something is off here.

 

 

shlomiohana
Obsidian | Level 7
I accidentally misspelled the error in the post, I corrected it.
shlomiohana
Obsidian | Level 7
I gave 777 permissions to the folder and it worked fine.
Kurt_Bremser
Super User

Since cleanwork requires to be run by root, I would also set root as the owner of the directory and give write permission only to the user (drwxr-xr-x). Otherwise other users would be able to remove log files from there and/or write garbage there.

suga badge.PNGThe SAS Users Group for Administrators (SUGA) is open to all SAS administrators and architects who install, update, manage or maintain a SAS deployment. 

Join SUGA 

Get Started with SAS Information Catalog in SAS Viya

Learn how to explore data assets, create new data discovery agents, schedule data discovery agents, and much more.

Find more tutorials on the SAS Users YouTube channel.

Discussion stats
  • 5 replies
  • 203 views
  • 1 like
  • 2 in conversation