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.
3 REPLIES 3
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.

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
  • 3 replies
  • 94 views
  • 0 likes
  • 2 in conversation