Advertisement
iPlain

unionFS remove rclone (tv)

Jun 16th, 2017
112
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #!/bin/bash
  2. # Remove unionFS hidden files created by Sonarr removing older content
  3. # Add script to crontab by typing crontab -e and pasting the line below (without # in front )
  4. # * * * * * /home/scripts/logs/fuse-delete-tv.cron >/dev/null 2>&1
  5. # Make script executable with: chmod a+x /home/scripts/logs/fuse-delete-tv.cron
  6.  
  7. logfile="/home/scripts/logs/fuse-delete-tv.cron.log"
  8.  
  9. if pidof -o %PPID -x "fuse-delete-tv.cron"; then
  10. echo "$(date "+%d.%m.%Y %T") EXIT: fuse-delete-tv.cron already running."
  11. exit 1
  12. fi
  13.  
  14. find /home/plex/fuse-tv/.unionfs-fuse -name '*_HIDDEN~' | while read line; do
  15. oldPath=${line#/home/plex/fuse-tv/.unionfs-fuse}
  16. newPath=tv-gd:${oldPath%_HIDDEN~}
  17. echo "$(date "+%d.%m.%Y %T") REMOVED $newPath" | tee -a "$logfile"
  18. rclone delete "$newPath"
  19. rm -f "$line"
  20. done
  21. find "/home/plex/fuse-tv/.unionfs-fuse" -mindepth 1 -type d -empty -delete
  22. exit
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement