Necrotic Posted July 14, 2013 Share Posted July 14, 2013 I have been wanting to create an unMenu package to do this... will see if/when I get to it this weekend. Prostuff, where you finally able to create an unMenu package for this? or did anyone create a simple plugin? Quote Link to comment
ScienTiFIC Posted October 21, 2013 Share Posted October 21, 2013 Since no one is adding this to Unmenu or Simple Features Can we get 1 or 2 of the best scripts that people are using to implement the Recycle bin for samba shares.. The posts shows 2 scripts I found useful but would like someone to explain what the script does and how to delete the files when the are in the Recycle bin (folder). The smb-extra.conf file should be created in your config folder on the flash drive. (located at /boot/config if logged in via telnet or on the system console) Thanks to all. Script 1. Thanks to Koperfild [bIN] path = /mnt/user/BIN read only = No [global] vfs objects = recycle recycle:repository = /mnt/user/BIN/%m recycle:keeptree = Yes recycle:touch = Yes recycle:versions = Yes recycle:exclude = *.tmp recycle:exclude_dir = /tmp recycle:noversions = *.doc Nice... Easy too. Do you think if you add BIN to the exclude list, like this: recycle:exclude_dir = /tmp|/mnt/user/BIN you could then delete from the BIN share without the "recursive" recycle? You might need to put the directory in place for each disk, like this: recycle:exclude_dir = /tmp|/mnt/user/BIN|/mnt/disk1/BIN|/mnt/disk2/BIN|/mnt/disk3/BIN|/mnt/disk4/BIN|/mnt/disk5/BIN If Joe made a good suggestion to Koperfild code what would be the Final script to put in the config file. In a brief summary can you explain how this scripts works and how to delete the BIN (recycle bin) files. Script 2 Thanks to Jowi [global] vfs objects = recycle recycle:repository = %P/.Recycle.Bin recycle:keeptree = Yes recycle:touch = Yes recycle:versions = Yes recycle:exclude = *.tmp recycle:exclude_dir = .Recycle.Bin Oh, didn't notice you had your setup completely different by using "%P" in the repository statement. I saw that in samples here? But i guess having one central place is better. I'm now using /mnt/user/.Recycle.Bin/%P so its centralized, but i can still tell where the file(s) came from using %P. How would this script look after the centralized location? How does this script work and how to delete files? Since I and many others are New to this can you please post all steps needed. 1. how to find file to edit The smb-extra.conf file should be created in your config folder on the flash drive. (located at /boot/config if logged in via telnet or on the system console) 2. what free program to use to edit file. can I use notepad or notepad++ 3. whats the best script to use for making files go to the Recycle bin on the same drive that you delete them from. whats the best script to use for making files go to the Recycle bin on the cache drive. 4. best way to delete the files in the recycle bin or bins Can we make a auto delete recycle bin script like the mover script for the cache drive? Thanks again to all Quote Link to comment
dcoens Posted October 22, 2013 Share Posted October 22, 2013 1. Edit file with something like "notepad2" for windows. 2. smb-extra.conf need to be Windows \\Tower(your_unraid_name)\flash\config or Telnet /boot/config folder. 3. Use attached or edit it using the websites provided below. 4. I always manually delete files in the ".Recycle.Bin" folder (using my script it will be at the top level of the share). the below is contained in the smb-extra.conf file. # Recycle options # http://www.samba.org/samba/docs/man/Samba-HOWTO-Collection/VFS.html#id2651247 # Recycle varibles # http://www.samba.org/samba/docs/man/manpages-3/smb.conf.5.html#idp52823744 # My usage # %S the name of the current service, if any. (which in unRaid equals the user share name), eg. Storage # %P the root directory of the current service, if any. eg /mnt/user/Storage # %u Username of the current service: will place users name who deleted the file/s # To apply changes execute: /etc/rc.d/rc.samba restart or restart unraid box [global] vfs objects = recycle recycle:repository = %P/.Recycle.Bin/%u recycle:keeptree = Yes recycle:touch = Yes recycle:touch_mtime = Yes recycle:versions = Yes recycle:exclude = *.tmp recycle:exclude_dir = .Recycle.Bin Note: recycle: repository - Remove the "."Recycle.bin if you don't want it hidden when you delete a file and recycle:exclude_dir Remove the "."Recycle.Bin smb-extra.conf Quote Link to comment
ScienTiFIC Posted October 22, 2013 Share Posted October 22, 2013 Thanks for the information Dcoens. Those links helped me out. I will try adding your conf file to my server.. Always scared of accidentally deleting something on the server. At least now I can give others write privileges. Quote Link to comment
Influencer Posted October 24, 2013 Share Posted October 24, 2013 Is this something that people would be interested in as a plug-in? For example a plug-in to allow the user to easily add/remove the "recycle bin" support, set a weekly cronjob to empty the trash and allow the user to manually empty the trash? Quote Link to comment
JonathanM Posted October 24, 2013 Share Posted October 24, 2013 Is this something that people would be interested in as a plug-in? For example a plug-in to allow the user to easily add/remove the "recycle bin" support, set a weekly cronjob to empty the trash and allow the user to manually empty the trash? I wouldn't want the trash emptied weekly, but perhaps aged out periodically. I don't want something in the trash for less than a specified period. Daily, weekly, monthly, whatever, but only permanently delete something that has been in the bin for more than what's configured. Quote Link to comment
drawz Posted October 24, 2013 Share Posted October 24, 2013 Is this something that people would be interested in as a plug-in? For example a plug-in to allow the user to easily add/remove the "recycle bin" support, set a weekly cronjob to empty the trash and allow the user to manually empty the trash? yes definitely. this one is especially confusing since there are several different scripts available Quote Link to comment
Influencer Posted October 24, 2013 Share Posted October 24, 2013 So you'd want something that would basically run a weekly cron that checked each files last access date (which is 'touched' by samba when its recycled) and if its been in the bin for more than 30 days to remove it? The number of days could be made configurable, just trying to make sure I got what your saying right. I guess I figured if I deleted something by accident I'd probably know immediately so deleting once a week would be safe. But at the same time if it happened to be 10 seconds before the cron was scheduled, might not have time even if the user immediately tried retrieving it. Quote Link to comment
dcoens Posted October 24, 2013 Share Posted October 24, 2013 Are you thinking something like the swapfile.plg? Something that is configurable via a page with optional inputs to how your recycle bin would be setup? I know some like the one location for recycle bin while some (like me) likes a "top level per share" The nice thing is that all these setting could be placed into the smb-extra.conf file. then do a stop / start of the share /etc/rc.d/rc.samba restart for it to take effect. That would be great! Quote Link to comment
ScienTiFIC Posted October 24, 2013 Share Posted October 24, 2013 So you'd want something that would basically run a weekly cron that checked each files last access date (which is 'touched' by samba when its recycled) and if its been in the bin for more than 30 days to remove it? The number of days could be made configurable, just trying to make sure I got what your saying right. I guess I figured if I deleted something by accident I'd probably know immediately so deleting once a week would be safe. But at the same time if it happened to be 10 seconds before the cron was scheduled, might not have time even if the user immediately tried retrieving it. That sounds good and also what dcoens mentioned.. Having the option for the location of the recycle bin.(1 HD or All HD's or Cache Drive) Also can the cron job be scheduled to delete the whole week or month but not the last 12/24 hours? That way even if a person makes the mistake of deleting before a cron job, they will still have time to retrieve his/her file. Also can you show the user or computer that deleted the file? Thanks . Quote Link to comment
JM2005 Posted October 24, 2013 Share Posted October 24, 2013 Is this something that people would be interested in as a plug-in? For example a plug-in to allow the user to easily add/remove the "recycle bin" support, set a weekly cronjob to empty the trash and allow the user to manually empty the trash? Sounds good to me! Quote Link to comment
DaleWilliams Posted October 25, 2013 Share Posted October 25, 2013 A plug in would be Great! I tried the do-it-yourself script method, and ...{edited to clarify} had unrelated problems and backed out....too scary. ;( {end edit} A chron that deletes anything older than <some> period of time would be fine...and/or just a manual 'empty trash' button. Quote Link to comment
Influencer Posted October 25, 2013 Share Posted October 25, 2013 Did you get your directories fixed? And are they screwed up on the server or through the samba shares? Quote Link to comment
graywolf Posted October 26, 2013 Share Posted October 26, 2013 Is this something that people would be interested in as a plug-in? For example a plug-in to allow the user to easily add/remove the "recycle bin" support, set a weekly cronjob to empty the trash and allow the user to manually empty the trash? Yes. Think this would be an excellent plug-in. I have it in place myself (Recycle Bin) and have it scripted to each day remove from the recycle bin anything that has been in there over 7 days. Quote Link to comment
Influencer Posted October 26, 2013 Share Posted October 26, 2013 I've sent the plugin to a couple people to test, works fine for me so just making sure it works good for others as well. I'll eventually add in a couple more options but currently you can either manually delete via the settings page or choose the option to delete automatically via cron. If that option is enabled you can set how long to wait before a file is deleted. The cron currently runs Sunday morning at 3 am. I could do daily but I figured once a week should be enough. Quote Link to comment
StevenD Posted October 26, 2013 Share Posted October 26, 2013 One option I would like to see (if you dont mind taking suggestions)... I need the Recycle Bin on my Cache drive cleared more frequently than /user. I only have a 180GB SSD, so the Recycle Bin can fill up every couple of days. So, it would be nice to have two different cron jobs for /cache and /user. Quote Link to comment
Influencer Posted October 26, 2013 Share Posted October 26, 2013 If you set the recycle bin as a share and not one for each share you would bypass that issue. I'm still not sure why someone would want a different bin for each share, set up as it is now it will keep the path so you'd know what share the deleted files came from. Quote Link to comment
StevenD Posted October 26, 2013 Share Posted October 26, 2013 This is the path Im using: recycle:repository = /mnt/user/.Recycle.Bin/%P This is what works best for me. Quote Link to comment
DaleWilliams Posted October 26, 2013 Share Posted October 26, 2013 Did you get your directories fixed? And are they screwed up on the server or through the samba shares? Thanks for the concern, Influencer. The short answer is 'Yes' but I don't think Recycle is the problem. It looks as if its the same problem just reported here, http://lime-technology.com/forum/index.php?topic=29757.0 Quote Link to comment
dcoens Posted October 27, 2013 Share Posted October 27, 2013 I'm still not sure why someone would want a different bin for each share, set up as it is now it will keep the path so you'd know what share the deleted files came from. I have a share for each user in my household. They all use unraid to store their homework and personal files on each of their personal space (share) that only they only have access to. If they delete something accidentally, they know where to get it (fail safe). In addition if someone deletes a common share file, I can still retrieve it. Unraid with its parity drive makes it nice to use instead of using the unprotected drive on each separate computer. This approach has worked out well. Quote Link to comment
binhex Posted October 30, 2013 Share Posted October 30, 2013 Is this something that people would be interested in as a plug-in? For example a plug-in to allow the user to easily add/remove the "recycle bin" support, set a weekly cronjob to empty the trash and allow the user to manually empty the trash? absolutely!!, would love a recycle bin plugin, would def like the options of daily/weekly/monthly/manual empty of trash. Quote Link to comment
Influencer Posted November 2, 2013 Share Posted November 2, 2013 Here's the initial release. I've been using it and have sent it to a few other users. What the plugin does: Once enabled the plug-in copies the config to your smb-extra.conf, if the file does not exist it is created. Here is the config: #vfs_recycle_start #Recycle bin share [bIN] path = /mnt/user/BIN read only = No #vfs config [global] vfs objects = recycle recycle:repository = /mnt/user/BIN/%m/%P recycle:keeptree = Yes recycle:touch = Yes recycle:versions = Yes recycle:exclude = *.tmp recycle:exclude_dir = /tmp recycle:noversions = *.doc #vfs_recycle_end Do NOT remove the comments from the config, they are used to add and remove the config if a user wishes to disable the recycle bin. Options will be added in the near future to allow customization of the recycle bins path as well as repository options, as for now it will create a share named BIN, when a file is deleted it will be put in a directory named after the current user, and then in the full path to the file so you will know where the file came from if you were to wish to restore it. Also included is the option to permanently delete the trash once a week. Enabling this feature creates a cronjob that runs every Sunday at 3:30 AM. Default the cron will be set to remove files that were deleted/trashed over 720 minutes (12 hours) ago. This option is user configurable and MUST be in minutes. I chose minutes as I believe this will allow the users the most flexibility on what files to delete. To delete everything simply set to 1 minute. 0 minutes should work fine too but I haven't tested that. If you want every file older than 7 days deleted, set it to 10080. Also when on the plug-ins settings page you'll notice a trash bin on the left side of the screen. This bin will change from an empty bin to a full bin when you have trash, as well as reporting the current size of the bin. You may manually delete everything in the recycle bin by simply clicking the "empty trash" button. This will save less experienced users from possibly having a typo and removing a lot more than they intended. Alright, so that should explain it all. Until options to modify the paths are added you may edit the smb-extra.conf located in /boot/config/plugins/vfs_recycle/config/. This is the base file used to add/remove the config from samba. If you wish to add anything to it just be sure to keep any additions/changes between the #vfs_recycle_start and #vfs_recycle_end comments. Grab it HERE! (right click > save as) Quote Link to comment
sacretagent Posted November 2, 2013 Share Posted November 2, 2013 great job as usual I had it running standard version so all i did is rename may smb-extra.conf file installplg /boot/config/plugins/vfs_recycle_unplugged.plg and enabled it in config page Quote Link to comment
DaleWilliams Posted November 3, 2013 Share Posted November 3, 2013 Here's the initial release. I've been using it and have sent it to a few other users. ... Grab it HERE! (right click > save as) Excellent! Thank you so much, Influencer. It installed like a charm. I can't wait to start deleting stuff! Quote Link to comment
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.