Goal is to identify user files which have not been accessed in X-day, and send notification to users using mailx. Also if user haven't access files in X-days those files will be archives and removed.
Below are more details:
Looking for someone to write a shell script (.sh, .ksh) that will run on Solaris OS as a cron job. Below are the requirements:
Script will read input file called: users.txt. Here is the sample file:
username1 [url removed, login to view]
username2 [url removed, login to view]
username3 [url removed, login to view]
Basically this script need to identify "*.txt", "*.logs" files in users home directory which have not been accessed by a user in 10-days (-atime).
So working folder will be /export/home1 /export/home2 which will contain all user directories. Example find command could be:
find /export/home1 /export/home2 -atime +10 -name "*.txt" -o -name "*.logs"
So basically I want the script to find the file in user home directories which haven't been accessed in the past 10 days, and send the users an email notification using mailx. Same script will also look for similar files which have not been accessed for 15-days and these files will be moved to an archive directory and stored as a compress file ex: [url removed, login to view] or .Z
Archive functionality should have the option to be turn on and off and used on need bases only. Meaning I should have the option to run this script just for email notification purpose. Sendmail is configured on this server.
I am open for suggestions. Let me know if additional info is needed.
I need this script done fast. So hopefully someone out there already has a similar script written.