Updated: Cache_Dirs V1.6.7 in an unRAID V5.0 Plugin


Recommended Posts

This is an unRAID V5.0 Plugin which is essentually a wrapper for the cache_dirs script written by Joe L (http://lime-technology.com/forum/index.php?topic=4500.0). This plugin will automatically start the cache_dirs script on mounting of the array. It has a settings page for easy configuration.

 

Installation:

create a directory called "plugins" at the root of your unraid USB key and copy the .plg file into it.

 

Run:

The plugin script will automatically run when the unRAID server starts up.

However, it you want to start the plugin without rebooting, either go to the console or telnet into the server

at the prompt, type

installplg /boot/plugins/cache_dirs-1.6.7-4jr.plg

 

Please report any problems with the plugin here. If you have specific issues or feature requests for the cache_dirs script, please direct them here http://lime-technology.com/forum/index.php?topic=4500.0

 

Files: Updated to V1.6.7 (2013-02-13)

plugin file: http://dl.dropbox.com/u/73389880/cache_dirs-files/cache_dirs-1.6.7-4jr.plg

 

Change Log:

V1.6.7-4 - 2013-02-13 - More fixes to the config screen

V1.6.7-3 - 2013-02-12 - Bugfix in config code and cosmetic fix

V1.6.7-2 - 2013-02-05 - Added cache_pressure to the config screen

V1.6.7 - 2013-01-24 - Updated to V1.6.7 of cache_dirs. Version number of plugin now relates to version number of cache_dirs

V0.7 - 2012-05-03 - Bug Fix, Corrected a type in the rc.cache_dirs script.

V0.6 - 2012-05-02 - Bug Fix, Corrected an error in the rc.cache_dirs script that was causing an error for some people.

V0.5 - 2012-05-01 - Bug Fix, fixed include and exclude directory bug. Thanks mp328 for pointing it out.

V0.4 - 2012-04-30 - Bug Fix, Corrected a bug in the cleanup script

V0.3 - 2012-04-27 - First Public release of the plugin

 

Screenshots:

cache_dirs-1-settings_menu.png

 

cache_dirs-3-configuration_menu_1.6.7.PNG

Link to comment
  • Replies 56
  • Created
  • Last Reply

Top Posters In This Topic

Top Posters In This Topic

Posted Images

im trying to exclude "Backup,mysql,.Finished,.plugins" and only do "Videos,Pictures,Music,Other" but it seems its ignoring the include/exclude lines and caching them all

 

other than that, great work  :)

 

Apr 26 19:18:01 unRaid cache_dirs: ==============================================
Apr 26 19:18:01 unRaid cache_dirs: command-args=-w -m 5 -d 9999 -e
Apr 26 19:18:01 unRaid cache_dirs: vfs_cache_pressure=10
Apr 26 19:18:01 unRaid cache_dirs: max_seconds=10, min_seconds=5
Apr 26 19:18:01 unRaid cache_dirs: max_depth=9999
Apr 26 19:18:01 unRaid cache_dirs: command=find -noleaf
Apr 26 19:18:01 unRaid cache_dirs: version=1.6.6
Apr 26 19:18:01 unRaid cache_dirs: ---------- caching directories ---------------
Apr 26 19:18:01 unRaid cache_dirs: .Finished
Apr 26 19:18:01 unRaid cache_dirs: .plugins
Apr 26 19:18:01 unRaid cache_dirs: Backup
Apr 26 19:18:01 unRaid cache_dirs: Music
Apr 26 19:18:01 unRaid cache_dirs: Other
Apr 26 19:18:01 unRaid cache_dirs: Pictures
Apr 26 19:18:01 unRaid cache_dirs: Videos
Apr 26 19:18:01 unRaid cache_dirs: mysql
Apr 26 19:18:01 unRaid cache_dirs: ----------------------------------------------
Apr 26 19:18:01 unRaid cache_dirs: cache_dirs process ID 19573 started, To terminate it, type: cache_dirs -q

Link to comment

im trying to exclude "Backup,mysql,.Finished,.plugins" and only do "Videos,Pictures,Music,Other" but it seems its ignoring the include/exclude lines and caching them all

 

other than that, great work  :)

I think I have located the problem and I'm working on a fix how. Will post the results shortly.

Link to comment

sorry to bug u again.

 

i installed the new version, but i can't get it to restart the process now. i didnt think it would be anything other than install new plg file and enable the service on the settings page. or am i missing something here. i even turned the service to NO and applied it, then deleted the cfg and reinstalled the plg and still nothing.

 

i can see some error coming up when i hit the apply button, but it goes so fast i cant read the stupid thing and only note in the syslog is this when i installed the new plg file.

 

May  1 16:32:17 unRaid cache_dirs: killing cache_dirs process 23674 (Minor Issues)

 

i prefer not having to reboot the machine, but i may have to this weekend, i can try it then again.

Link to comment
  • 1 month later...
  • 3 weeks later...
  • 6 months later...

Could I trouble you to include the cache_pressure as a configurable item in the php section and write the value to the cfg file to be read in on next load?  You have it hard coded to 10 and not everyone uses that setting.  It is great for a default, but would like the option to change it without editing the plugin file.

Link to comment

I installed this, and am having problems with my server refusing to spin any drives down.

 

I also was having issues with it not wanting to unmount the drives for shutdown.  It give the "attempting to unmount", for a long time.  So I sent a "powerdown now" from Putty.  This didn't work either.  I then did it from the console too.  Again no luck. 

 

I will try 1.6.7 native cache_dirs from Joe and see if it is any different.

Link to comment
  • 2 weeks later...
  • 2 weeks later...

Looks like the CACHE_PRESSURE parameter isn't getting captured in the PARAMS parameter in cache_dirs.cfg file, so not changing from default when cache_dirs starts.

 

Here's a copy of my cache_dirs.cfg file:

SERVICE="enable"
WAIT_ARRAY="-w"
SEC_MIN="1"
SEC_MAX="10"
SHORTER_LOG=""
MAX_DEPTH="3"
FIND_ALT=""
ARGS=""
SCAN_USER=""
EXCLUDE=""
INCLUDE=""
DISKS_BUSY=""
CACHE_PRESSURE="50"
MOVER=""
CONCISE_LOG=""
PARAMS= -w -d 3

 

Here's the startup snippet from syslog:

Feb 17 06:12:23 Tower cache_dirs: ==============================================
Feb 17 06:12:23 Tower cache_dirs: command-args=-w -d 3
Feb 17 06:12:23 Tower cache_dirs: vfs_cache_pressure=10
Feb 17 06:12:23 Tower cache_dirs: max_seconds=10, min_seconds=1
Feb 17 06:12:23 Tower cache_dirs: max_depth=3
Feb 17 06:12:23 Tower cache_dirs: command=find -noleaf
Feb 17 06:12:23 Tower cache_dirs: version=1.6.7
Feb 17 06:12:23 Tower cache_dirs: ---------- caching directories ---------------
Feb 17 06:12:23 Tower cache_dirs: Docs
Feb 17 06:12:23 Tower cache_dirs: HDVideo
Feb 17 06:12:23 Tower cache_dirs: Music
Feb 17 06:12:23 Tower cache_dirs: Photos
Feb 17 06:12:23 Tower cache_dirs: System
Feb 17 06:12:23 Tower cache_dirs: TV
Feb 17 06:12:23 Tower cache_dirs: Video
Feb 17 06:12:23 Tower cache_dirs: custom
Feb 17 06:12:23 Tower cache_dirs: ----------------------------------------------
Feb 17 06:12:23 Tower cache_dirs: cache_dirs process ID 27262 started, To terminate it, type: cache_dirs -q

 

Kevin

Link to comment
  • 4 weeks later...

ok, might be a stupid question (but than again, there are no stupid questions, just stupid answers ;) )

once i hit the link to get the file from the first post i get a page with code and comments... so i assume i am supposed to create the file with the rite name (cache_dirs-1.6.7-4jr.plg) and copy the whole stuff into it?

it's cool with me, i guess i will manage that. just strives me as odd. usually you get a zip (or sth along that way) at the d/l.

 

if i am wrong here and my browser is just f*cking with me, please let me know!

 

thx, lars

Link to comment
  • 1 month later...

ok, might be a stupid question (but than again, there are no stupid questions, just stupid answers ;) )

once i hit the link to get the file from the first post i get a page with code and comments... so i assume i am supposed to create the file with the rite name (cache_dirs-1.6.7-4jr.plg) and copy the whole stuff into it?

it's cool with me, i guess i will manage that. just strives me as odd. usually you get a zip (or sth along that way) at the d/l.

 

if i am wrong here and my browser is just f*cking with me, please let me know!

 

thx, lars

 

do right click > save link as..

 

anyone else having issues where cache_dirs does not stop when stopping the array.. even when i telnet in and do cache_dirs -q it is still running the find process for a while before finally stopping.

Link to comment
  • 4 weeks later...

anyone else having issues where cache_dirs does not stop when stopping the array.. even when i telnet in and do cache_dirs -q it is still running the find process for a while before finally stopping.

 

same problem too.

i dont know why but cache dirs is not triggered with event unmounting_disks. i made some edit on the plugin to trigger stop script with the unmounting_disk event but still cant stop the array because of busy disk(s):

<!-- event handler -->
<FILE Name="/usr/local/emhttp/plugins/cache_dirs/event/unmounting_disks" Mode="0770">
<INLINE>
<![CDATA[
#!/bin/bash
/etc/rc.d/rc.cache_dirs stop
]]>
</INLINE>
</FILE>

 

May 23 00:03:52 Tower emhttp: Stop SMB...
May 23 00:03:52 Tower emhttp: shcmd (3500): /etc/rc.d/rc.samba stop |& logger
May 23 00:03:52 Tower emhttp: Spinning up all drives...
May 23 00:03:52 Tower emhttp: Sync filesystems...
May 23 00:03:52 Tower emhttp: shcmd (3501): sync
May 23 00:03:52 Tower kernel: mdcmd (21): spinup 0
May 23 00:03:52 Tower kernel: mdcmd (22): spinup 1
May 23 00:03:52 Tower kernel: mdcmd (23): spinup 2
May 23 00:03:52 Tower kernel: mdcmd (24): spinup 3
May 23 00:03:52 Tower kernel: mdcmd (25): spinup 4
May 23 00:03:56 Tower emhttp: shcmd (3502): /usr/local/sbin/emhttp_event unmounting_disks
May 23 00:03:56 Tower emhttp_event: unmounting_disks
May 23 00:04:06 Tower ntfs-3g[24533]: Unmounting /dev/sdh1 (FreeAgent Drive) 
May 23 00:04:06 Tower emhttp: shcmd (3503): set -o pipefail ; umount /mnt/user |& logger
May 23 00:04:06 Tower emhttp: shcmd (3504): rmdir /mnt/user |& logger
May 23 00:04:06 Tower emhttp: shcmd (3505): crontab -c /etc/cron.d -d &> /dev/null
May 23 00:04:06 Tower emhttp: Unmounting disks...
May 23 00:04:06 Tower emhttp: shcmd (3506): umount /mnt/disk1 |& logger
May 23 00:04:06 Tower logger: umount: /mnt/disk1: device is busy.
May 23 00:04:06 Tower logger:         (In some cases useful info about processes that use
May 23 00:04:06 Tower logger:          the device is found by lsof( or fuser(1))
May 23 00:04:06 Tower emhttp: shcmd (3507): umount /mnt/disk2 |& logger
May 23 00:04:06 Tower logger: umount: /mnt/disk2: device is busy.
May 23 00:04:06 Tower logger:         (In some cases useful info about processes that use
May 23 00:04:06 Tower logger:          the device is found by lsof( or fuser(1))
May 23 00:04:06 Tower emhttp: shcmd (3508): umount /mnt/disk3 |& logger
May 23 00:04:06 Tower logger: umount: /mnt/disk3: device is busy.
May 23 00:04:06 Tower logger:         (In some cases useful info about processes that use
May 23 00:04:06 Tower logger:          the device is found by lsof( or fuser(1))
May 23 00:04:06 Tower emhttp: shcmd (3509): umount /mnt/disk4 |& logger
May 23 00:04:06 Tower logger: umount: /mnt/disk4: device is busy.
May 23 00:04:06 Tower logger:         (In some cases useful info about processes that use
May 23 00:04:06 Tower logger:          the device is found by lsof( or fuser(1))
May 23 00:04:06 Tower emhttp: Retry unmounting disk share(s)...
May 23 00:04:11 Tower emhttp: Unmounting disks...

this cycle loops for ~4 minutes and:

May 23 00:08:27 Tower emhttp: Retry unmounting disk share(s)...
May 23 00:08:32 Tower emhttp: Unmounting disks...
May 23 00:08:32 Tower emhttp: shcmd (3718): umount /mnt/disk1 |& logger
May 23 00:08:32 Tower logger: umount: /mnt/disk1: device is busy.
May 23 00:08:32 Tower logger:         (In some cases useful info about processes that use
May 23 00:08:32 Tower logger:          the device is found by lsof( or fuser(1))
May 23 00:08:32 Tower emhttp: shcmd (3719): umount /mnt/disk2 |& logger
May 23 00:08:32 Tower logger: umount: /mnt/disk2: device is busy.
May 23 00:08:32 Tower logger:         (In some cases useful info about processes that use
May 23 00:08:32 Tower logger:          the device is found by lsof( or fuser(1))
May 23 00:08:32 Tower emhttp: shcmd (3720): umount /mnt/disk3 |& logger
May 23 00:08:32 Tower logger: umount: /mnt/disk3: device is busy.
May 23 00:08:32 Tower logger:         (In some cases useful info about processes that use
May 23 00:08:32 Tower logger:          the device is found by lsof( or fuser(1))
May 23 00:08:33 Tower emhttp: shcmd (3721): umount /mnt/disk4 |& logger
May 23 00:08:33 Tower logger: umount: /mnt/disk4: device is busy.
May 23 00:08:33 Tower logger:         (In some cases useful info about processes that use
May 23 00:08:33 Tower logger:          the device is found by lsof( or fuser(1))
May 23 00:08:33 Tower emhttp: Retry unmounting disk share(s)...
May 23 00:08:34 Tower cache_dirs: Suspending cache_dirs for 120 seconds to allow for clean shutdown of array
May 23 00:08:34 Tower cache_dirs: While suspended, pressing "Stop" on the unRAID management web-interface will shutdown the array
May 23 00:08:38 Tower emhttp: Unmounting disks...
May 23 00:08:38 Tower emhttp: shcmd (3722): umount /mnt/disk1 |& logger
May 23 00:08:38 Tower emhttp: shcmd (3723): rmdir /mnt/disk1 |& logger
May 23 00:08:38 Tower emhttp: shcmd (3724): umount /mnt/disk2 |& logger
May 23 00:08:38 Tower emhttp: shcmd (3725): rmdir /mnt/disk2 |& logger
May 23 00:08:38 Tower emhttp: shcmd (3726): umount /mnt/disk3 |& logger
May 23 00:08:39 Tower emhttp: shcmd (3727): rmdir /mnt/disk3 |& logger
May 23 00:08:39 Tower emhttp: shcmd (3728): umount /mnt/disk4 |& logger
May 23 00:08:40 Tower emhttp: shcmd (3729): rmdir /mnt/disk4 |& logger
May 23 00:08:40 Tower emhttp: shcmd (3730): /usr/local/sbin/emhttp_event stopping_array
May 23 00:08:40 Tower emhttp_event: stopping_array
May 23 00:08:40 Tower kernel: mdcmd (26): stop 
May 23 00:08:40 Tower kernel: md1: stopping
May 23 00:08:40 Tower kernel: md2: stopping
May 23 00:08:40 Tower kernel: md3: stopping
May 23 00:08:40 Tower kernel: md4: stopping

 

These comments in the plugin file says press stop twice but i want it to stop it with event handler. any clue what is missing?

# Version 1.6   - Fixed bug... if -q was used, and cache_dirs not currently running, 
#               it started running in error. OOps... Added the missing "exit"
#               - Changed vfs_cache_pressure setting to be 1 instead of 0 by default.
#               - Added "-p cache_pressure" to allow experimentation with vfs_cache_pressure values
#                (If not specified, default value of 1 will be used)
#               - Made -noleaf the default behavior for the "find" command (use -a "" to disable).
[b]#               - Added logic to force all disks "busy" by starting a process with each as their
#               current working directory.   This will prevent a user from seeing a frightening
#               Unformatted description if they attempt to stop the array.  A second "Stop" will
#               succeed (the scan is paused for 2 minutes, so it may be stopped cleanly)[/b]

 

# if we detect an attempt to stop the array without quiting this cache_dirs program we will
# suspend the scanning of directories for a duration to allow a clean Stop of the array.
# (Basically, press the "Stop" button again within this window of time as first will NOT
# stop the array since we have forced  all the disks busy. )

Link to comment

cache_dirs DOES stop itself, but I found it is not possible to interrupt an individual "find" command within it, so any given "find" that is in progress must complete before it will stop itself.  You must just be patient.  cache_dirs checks in between each "find" command to see if the array is being stopped and automatically suspends itself.  Do not get fooled by the comment about pressing "Stop" twice.  That comment/logic is there and necessary for those with older versions of unRAID. (pre 4.5 I think)

 

Joe L.

Link to comment
  • 2 weeks later...

Thanks for getting Cache_Dirs into a plugin!

 

I installed it on my system today by just dropping the .plg file into the \boot\plugins folder. After a reboot the plugin seemed to be working but I was missing the Cache_Dirs icon on the settings page (see attachment below).

 

After rereading the OP, I then went ahead and installed it manually from a telnet session and now the icon is showing.

 

Afterward, reviewed the Syslog and I noticed this line:

file /boot/config/plugins/cache_dirs/cache_dirs.png: downloading from http://dl.dropbox.com/u/73389880/cache_dirs-files/cache_dirs.png ... bad download, deleting

 

More of a FYI than anything else. Thanks again!

Cache-Dir-icon-problem2.jpg.ab6f95448d6f79043613899cf5973aaf.jpg

Link to comment

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.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.