[mR] Forums
Right now
 
your local time
HL2DM players
0/ 64
rp_cscdesert_v2JoinLive
City 17
0citizens awake
Under Combine rule, 14:16Enter the city
Discord
29online
0 in voiceOpen
Forum
0members here
nobody signed in
Builds saved
29,665
by 1,176 builders since 2008Browse

Cloud Cleaner

Started by .Lb, 08-13-2014, 11:56 AM7 replies8,653 viewsLinear Mode
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
.Lb RetiredLv.1 Away 08-13-2014, 11:56 AM #1
Wrote a bash script for linux that cleans up movies, music and such that are older than a certain amount of days. Perfect for seedboxes. It deletes Cams and Tele Syncs older than 30 days and Webrips after 60 days. It then emails the log of what was done to me.
I scheduled this with a cron job to run cleanup once a week.

Code:
#/bin/bash
#run loop for each file in the directory
echo "Ran cleanup on cloud" > /tmp/mail_report.log
cd /var/www/rtorrent/complete/
find ./movies/ -iname '*cam.*' -mtime +30 >> /tmp/mail_report.log
find ./movies/ -iname '*cam *' -mtime +30 >> /tmp/mail_report.log
find ./movies/ -name '*TS *' -mtime +30 >> /tmp/mail_report.log
find ./movies/ -iname '*HDTS*' -mtime +30 >> /tmp/mail_report.log
find ./movies/ -iname '*HDCAM*' -mtime +30 >> /tmp/mail_report.log
find ./movies/ -iname '*HD-TS*' -mtime +30 >> /tmp/mail_report.log
find ./movies/ -iname '*WEBRIP*' -mtime +60 >> /tmp/mail_report.log
find ./movies/ -iname '*WEB-RIP*' -mtime +60 >> /tmp/mail_report.log
find ./movies/ -iname '*WEBDL*' -mtime +60 >> /tmp/mail_report.log
find ./movies/ -iname '*WEB-DL*' -mtime +60 >> /tmp/mail_report.log
find ./tele/ -iname '*' -mtime +90 >> /tmp/mail_report.log
find ./applications/ -iname '*' -mtime +60 >> /tmp/mail_report.log
find ./games/ -iname '*' -mtime +90 >> /tmp/mail_report.log
find ./music/ -iname '*' -mtime +120 >> /tmp/mail_report.log
find ./movies/ -iname '*' -mtime +120 >> /tmp/mail_report.log
find ./others/ -iname '*' -mtime +90 >> /tmp/mail_report.log


find ./movies/ -iname '*cam.*' -mtime +30 -exec rm -rf {} \;
find ./movies/ -iname '*cam *' -mtime +30 -exec rm -rf {} \;
find ./movies/ -name '*TS *' -mtime +30 -exec rm -rf {} \;
find ./movies/ -iname '*HDTS*' -mtime +30 -exec rm -rf {} \;
find ./movies/ -iname '*HDCAM*' -mtime +30 -exec rm -rf {} \;
find ./movies/ -iname '*HD-TS*' -mtime +30 -exec rm -rf {} \;
find ./movies/ -iname '*WEBRIP*' -mtime +60 -exec rm -rf {} \;
find ./movies/ -iname '*WEB-RIP*' -mtime +60 -exec rm -rf {} \;
find ./movies/ -iname '*WEBDL*' -mtime +60 -exec rm -rf {} \;
find ./movies/ -iname '*WEB-DL*' -mtime +60 -exec rm -rf {} \;
find ./tele/ -iname '*' -mtime +90 -exec rm -rf {} \;
find ./applications/ -iname '*' -mtime +60 -exec rm -rf {} \;
find ./games/ -iname '*' -mtime +90 -exec rm -rf {} \;
find ./music/ -iname '*' -mtime +120 -exec rm -rf {} \;
find ./movies/ -iname '*' -mtime +120 -exec rm -rf {} \;
find ./others/ -iname '*' -mtime +90 -exec rm -rf {} \;
df -h >> /tmp/mail_report.log
mail -s .CloudReport. [email protected] -- -f Cleanup < /tmp/mail_report.log &
Posts: 573 Joined: Jan 2010 Reputation: 2,024
Reply

Messages In This Thread
Cloud Cleaner - by .Lb - 08-13-2014, 11:56 AM
RE: Cloud Cleaner - by mIKe - 08-13-2014, 01:16 PM
RE: Cloud Cleaner - by Ackros - 08-14-2014, 12:04 PM
RE: Cloud Cleaner - by .Lb - 08-14-2014, 01:52 PM
RE: Cloud Cleaner - by Videowarrior - 08-19-2014, 05:11 PM
RE: Cloud Cleaner - by .Lb - 08-19-2014, 05:31 PM
RE: Cloud Cleaner - by mIKe - 08-20-2014, 06:02 AM
RE: Cloud Cleaner - by maxx237 - 08-20-2014, 07:51 PM
Users browsing this thread: 1 Guest(s)