Could someone please help me with a shell script task I need to conquer? I am new to Unix and have no idea where to start. Here is my problem:
I have the following directories:
Inside /mylog/current/, there are log files created for each day, say "ulog_20050416.log" to "ulog_20050423.log". (Note the filename ends with Date Stamp.) I need a bourne shell script which will be run by a "cron" job once a week on Sunday. This script should concatenate the previous weeks' log files(Sun. to Sat.) into one weekly file say "ulog_weekly_20050416.log", then move it to /mylog/archive/. The script then deletes those daily log files. Note that the cron job runs on Sunday, so this Sunday's log file should remain untouched until next Sunday the script runs.
Inside the /mylog/archive, I only want to keep the weekly log file for 4 weeks. Any weekly file that is older than 4 weeks should be deleted by the script.
Finally, a symbolic link should be created/updated in the /mylog directory, say "/mylog/weekly-stat.log", which should point to the weekly log file that was just created above in /mylog/archive/. This way, the person who fetches the weekly file can use the same name "weekly-stat.log" every week.
I will really really appreciated if someone can help me with this? Or point me to the right direction. Thanks in advance.