Advertisement
iPlain

unionFS remove rclone (m)

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