in a script you can specify to save output to a file with current date/time like:

LOGFILE=/path/to/logfiles/$(date '+%Y-%m-%d')_task.log

echo "this script was run" >> $LOGFILE;

to cleanup regularly is important in order to ensure the harddisk does not fill up.

delete all temporary files older than 30 days:

find /path/to/logfiles/* -mtime +30 -type f -delete;
# qnap (busybox) compatible version
find /path/to/logfiles/* -mtime +2 -type f| xargs rm

be careful with find & delete X-D

BE CAREFUL WITH find + delete – find . -delete -name vs find . -name -delete

another example:

find /path/to/files* -mtime +5 -exec rm {} \; # delete all files in /path/to/files* that are older than 5 days

liked this article?

  • only together we can create a truly free world
  • plz support dwaves to keep it up & running!
  • (yes the info on the internet is (mostly) free but beer is still not free (still have to work on that))
  • really really hate advertisement
  • contribute: whenever a solution was found, blog about it for others to find!
  • talk about, recommend & link to this blog and articles
  • thanks to all who contribute!
admin