Recycle Bin script doesn't work anymore

Status
Not open for further replies.

WeiserMaster

Cadet
Joined
Nov 11, 2016
Messages
3
Hi there,

For a while now I've had a cron script which would delete the recycle bin folder on my NAS automatically.
But for whatever reason it doesn't execute the script properly, it will not erase the recycle bin folder and its contents.

This is the original script, which has been working:
Code:
#!/bin/sh
find /mnt/ -name ".recycle" > /tmp/list
cat /tmp/list | xargs -I % find %/ -atime +3 -exec rm -rf '{}' \;

And I've tried out several from Google, but I haven't written down which those were.. This is one of those:
Code:
find /mnt/vol1/*/.recycle/* -atime +3 -delete; find /mnt/vol1/*/.recycle/ -type d -empty -delete,

I've got one dataset (ds1) in volume1 (vol1), the directory for the pool is /mnt/vol1/ds1.

The user executing the scripts has got full access to everything on the disk, including the recycle bin folder.
I am able to delete files with that user, over the CLI and Windows Explorer.
I've tried running it over the cron tab, manually as root (which not surprisingly didn't work because of permissions) and manually as the user with full access to the volume.

I'm running FreeNAS-9.10.2-U1 (86c7ef5) on ESXi with a H310 in IT mode.

Do you guys know what is going wrong?

Thanks in advance,

WeiserMaster


Edit:

I also get these mails since proxmox writes backups to one of the backup shares, but the script isn't running properly since almost a month ago.
Code:
Cron <user@nas> PATH="/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin:/root/bin" /mnt/vol1/ds1/emptyrecycle.sh > /dev/null

find: /mnt/vol1/ds1/Backups/proxmox/dump: Permission denied

The proxmox backups were set up somewhere around 30th of march, so these shouldn't be the main reason why the backups weren't running. The oldest files in the .recycle folder were from the beginning of March.
 
Last edited by a moderator:

WeiserMaster

Cadet
Joined
Nov 11, 2016
Messages
3
I think its a bug, it works again since the upgrade to Corral.
I've been running version 9.10.2-U1 and upgraded to the newest version of the 9.10 train before switching to Corral.
Beware that various settings are changed after the upgrade.

Also, I've edited my script a bit.

This delets everything older then four days from vol1, works better now.


Code:
#!/bin/sh

find /mnt/vol1/*/.recycle/* -atime +4 -delete ; find /mnt/vol1/*/.recycle/* -type d -empty -delete
 
Last edited:
Status
Not open for further replies.
Top