wengi
Full Member
Posts: 102
|
Post by wengi on Apr 7, 2008 16:03:14 GMT 7
Hi omega,
improvements are always welcome. ;D My shell programming is very poor. The script worked for me and that was the first goal.
Good to know there are people out there who pick up the idea and make it perfect.
thank you wengi
EDIT
Still a problem: I am using multiple shares! According i have multiple .recycle folders.
The for ... done does not work as expected. Your first "$(find "$topDir" -maxdepth 2 -type d -name "$recDir" -print)" results in one string like "/raid/folder1/.recycle /raid/folder2/.recycle" which results in an "No such file or directory" in the second find.
Just add a line to see the prob:# Delete files older than ... in all dirs in recycle bin echo "This should only be one folder: " $recycleBin find "$recycleBin" -type f -mtime +$maxDays -print0 | xargs -0 rm -f This is my result:
buechse:/raid/rsync# ./test.sh This should only be one folder: /raid/album/.recycle /raid/Wengenroth/.recycle find: /raid/album/.recycle /raid/Wengenroth: No such file or directory find: /raid/album/.recycle /raid/Wengenroth: No such file or directory buechse:/raid/rsync#
Dont know how to fix this...
|
|
|
Post by omega on Apr 7, 2008 17:44:00 GMT 7
Hi wengi, sometimes I'm getting crazy with this Thecus software.... Of course I've tried my script - but on a standard SuSE Linux distribution and there it works.... But on the Thecus devices the Shell and the busybox exe (this one provides the find exe) are somehow limited.... First of all, the shell used on Thecus doesn't know how to handle quoted commands, therefore you see the two directories in one string. Of course they should expand to two strings. So I've changed my script to prevent this (see below). Second (and this applies only to N5200), the N5200 find executable is too dumb as it doesn't know the switches -depth, -empty and -print0. I'll add a real find exe to my UTILS module in the future, then this script will work too. Here is the new version of the script, please give it a try.... (unfortunately the identation is not preserved when posting here) #!/bin/sh ## ## omega: 7.4.2008 ##
# Set this variable to "N2100" or "N5200" NAS=N2100
# Delete files older than ... days in recycle bin maxDays=14
#########################################################################
if [ "$NAS" = N2100 ] ; then topDir=/raid FIND=find elif [ "$NAS" = N5200 ] ; then topDir=/raid/data echo "We do need a reasonable find executable installed first in order to run this script - aborting!" exit 1 else echo "Unsuported NAS - aborting!" exit 1 fi
recDir=.recycle
cd "$topDir" || exit 1
for recycleBin in */$recDir ; do # Delete files older than ... in all dirs in recycle bin $FIND "$recycleBin" -type f -mtime +$maxDays -print0 | xargs -0 rm -f
# Delete all empty folders (might became empty after deleting files) $FIND "$recycleBin" -depth -type d -empty -exec rmdir {} \; done
exit 0
CU Andreas
|
|
wengi
Full Member
Posts: 102
|
Post by wengi on Apr 7, 2008 19:27:13 GMT 7
This one seems to work. The limited shell took me some time too wengi
|
|
|
Post by spiken on Jun 26, 2008 23:00:02 GMT 7
I m making a recyclebin module for the n2100, it's nearly finished. The binaries progs works well, I have just to debug the gui html page and it's ok (but javascript and php aren't my good friends). Here the current html page & features offered.
|
|
wengi
Full Member
Posts: 102
|
Post by wengi on Jun 27, 2008 12:51:17 GMT 7
This is COOOOOOOOL! wengi
|
|
|
Post by spiken on Jun 29, 2008 5:22:41 GMT 7
Module is done ! You can find it with the release note under the wiki. For thoses who already have the recycle bin function working, please remove your modifications in the samba configuration file ( /raid/sys/smb.conf) before installing this module. Your comments are welcome !
|
|
Deleted
Deleted Member
Posts: 0
|
Post by Deleted on Jun 29, 2008 15:53:34 GMT 7
I get a message in french, that I am guessing is file/user not found.
If you send me a PM and I will give you me email address, so you can email me the file and I will upload it to my thecus module site.
|
|
|
Post by spiken on Jun 29, 2008 17:40:19 GMT 7
You can download the module with the folllowing link and select the "save as" option on the zip file. membres.lycos.fr/spikenhero/Images/Nas/N2100/Thanks for uploading it on your website johnrbaker, I will correct the wiki with your url.
|
|
Deleted
Deleted Member
Posts: 0
|
Post by Deleted on Jun 30, 2008 4:24:12 GMT 7
|
|
|
Post by metamorphose on Oct 3, 2008 15:35:48 GMT 7
This feature is great!!! I would like to say a big THANX.
I am an N5200 owner, I installed the module and I put this script in a file (I modified NAS variable, of course) what I start every time when NAS starts up (by startup.sh of META module), and it works fine.
I just experienced one wierd thing: I cannot enable Recycle Bin module on web-admin interface, so I cannot reach nice web interface of the module.
Is there any solution to enable this comfortable feature? (I know that it is N2100 module, never knows...)
|
|
|
Post by spiken on Oct 3, 2008 16:36:24 GMT 7
The n2100 RECYCLE_BIN module contains a binary which is compiled for an arm platform and path for the n2100 (/raid/ not /raid/data) . All the management is done into the binary instead of a shell like the previous one make by Wengi and Omega.
The gui is designed to works with the binary only, but it should be possible to adapt it to works with a shell. Unfortunately, I don't think I can help you a lot: I m not a good linux user and a poor linux shell programmer...
|
|