*New 11.4 series Release:
2020-07-03: XigmaNAS 11.4.0.4.7633 - released!

*New 12.1 series Release:
2020-04-17: XigmaNAS 12.1.0.4.7542 - released


We really need "Your" help on XigmaNAS https://translations.launchpad.net/xigmanas translations. Please help today!

Producing and hosting XigmaNAS costs money. Please consider donating for our project so that we can continue to offer you the best.
We need your support! eg: PAYPAL

[SOLVED]Recycle Bin

XigmaNAS Scripts and shell tips
Forum rules
Set-Up GuideFAQsForum Rules
Post Reply
Buzzin
Starter
Starter
Posts: 22
Joined: 14 Jan 2013 20:05
Status: Offline

[SOLVED]Recycle Bin

#1

Post by Buzzin »

I have enabled the recycle bin on my drives but have yet to figure a way of emptying them (had a bit of a clean up)

I found this script http://blog.hani-ibrahim.de/en/automati ... e-bin.html but for some reason I couldn't get it to run.

Is there an easier way of clearing junk from the drives?
Last edited by Buzzin on 18 Jan 2013 15:02, edited 1 time in total.

User avatar
raulfg3
Site Admin
Site Admin
Posts: 5119
Joined: 22 Jun 2012 22:13
Location: Madrid (ESPAÑA)
Contact:
Status: Offline

Re: Recycle Bin

#2

Post by raulfg3 »

must work, please post your delrecycle.sh and tell us what is the name of your share, and how do you launch script.
12.0.0.4 (revision 6766)+OBI on SUPERMICRO X8SIL-F 8GB of ECC RAM, 12x3TB disk in 3 vdev in RaidZ1 = 32TB Raw size only 22TB usable

Wiki
Last changes

HP T510

Buzzin
Starter
Starter
Posts: 22
Joined: 14 Jan 2013 20:05
Status: Offline

Re: Recycle Bin

#3

Post by Buzzin »

I deleted the script, but I copied the one from the link and changed accordingly:
#!/bin/sh
find /mnt/MOVIES1/.recycle/* -atime +10 -exec rm -rf '{}' \;
find /mnt/MOVIES1/.recycle/ -depth -type d -empty -exec rmdir {} \;
find /mnt/MOVIES2/.recycle/* -atime +10 -exec rm -rf '{}' \;
find /mnt/MOVIES2/.recycle/ -depth -type d -empty -exec rmdir {} \;
find /mnt/MOVIES3/.recycle/* -atime +10 -exec rm -rf '{}' \;
find /mnt/MOVIES3/.recycle/ -depth -type d -empty -exec rmdir {} \;
find /mnt/MUSIC/.recycle/* -atime +10 -exec rm -rf '{}' \;
find /mnt/MUSIC/.recycle/ -depth -type d -empty -exec rmdir {} \;
find /mnt/DATA/.recycle/* -atime +10 -exec rm -rf '{}' \;
find /mnt/DATA/.recycle/ -depth -type d -empty -exec rmdir {} \;

and the cron job command was:
sh /mnt/MOVIES1/delrecycle.sh
sh /mnt/MOVIES2/delrecycle.sh
sh /mnt/MOVIES3/delrecycle.sh
sh /mnt/MUSIC/delrecycle.sh
sh /mnt/DATA/delrecycle.sh

The cronjob was then set to check at 12.00am on the 1st, 15th & 30th day

I think the error message was cronjob unable to execute. I used the file manager built in to Nas4Free to create the delrecycle.sh
As stated before, I am very new to this and only ask questions when needed.

Buzzin
Starter
Starter
Posts: 22
Joined: 14 Jan 2013 20:05
Status: Offline

Re: Recycle Bin

#4

Post by Buzzin »

I got one to work but when I went back into the file to create another there was nothing there. It seems that once cron has run, it deletes the content of the file, the file is there but just blank!

Any ideas on that? Also, I did create one cron job per share but they will only run once if the contents of the file are getting deleted.

Buzzin
Starter
Starter
Posts: 22
Joined: 14 Jan 2013 20:05
Status: Offline

Re: [SOLVED]Recycle Bin

#5

Post by Buzzin »

raulfg3

All fixed, I realise what you meant by one cron job now. What I was doing was placing the delrecycle.sh into each share folder, now I have just put the .sh into my data folder and cron job now just looks there and executes the script.

Thanks for your help.

Post Reply

Return to “Scripts and shell tips”