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.
Please run this:
ls -ld /opt/sas/system_logs/cleanwork_log
and post the result.
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.
The SAS Users Group for Administrators (SUGA) is open to all SAS administrators and architects who install, update, manage or maintain a SAS deployment.
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.