Shutdown options to kill apps... And how to tell if Array is started from cmd li


Recommended Posts

I have the Sab/sickbeard/plex trio running from my cache drive. 

Works fine once started.  But Startup and shutdown are troublesome.

Right now .. my array is in the 'Retry unmounting user share(s) loop waiting for SABnzbd to stop. .. Maybe others.

I typically need to telnet in and issue the reboot cmd. 

(Note .. I am just doing this work to make sure it all works seamlessly when unattended.  I don't start/stop/reboot that often ;-)

 

I'm currently running 5.14b

 

So .. how to delay startup of plugins until the array is stable?  Is there a cmdline tool I can use ?

I've tried adding 'sleep 40s' to my go file ... Didn't seem to help.    (assuming it is after the emhttp start cmd ??)

And is there a way to auto-kill any app holding a file open during a shutdown ?

 

tia

Wes

Link to comment

I was optimistic ...

The array is still hanging in 'starting' if any of my Apps are enabled to start at system startup.

I have to go and 'disable' each application ... reboot... and than enable them one by one after startup.

 

It seems to be a common problem.. but I haven't seen a fix/workaround other than adding a sleep command to 'go'.

 

What am I missing ?

I'd just like unRaid to make sure the array is started properly before starting any Apps... and to shutdown all those Apps when the array is stopped. 

 

 

One other odd thing that may be relevant. 

Using the webgui for any of the add-ins is very very slow.  For example . clicking 'Sickbeard' from Settings will take about 30-60 seconds.

Any other gui work is pretty normal response. 

 

Here is my Go file ..

#!/bin/bash

 

# Start the Management Utility

/usr/local/sbin/emhttp &

echo 'Sleeping 30 secs'

sleep 30s

echo 'Done Sleeping'

 

#

 

And here are the plugins Im starting

open_vm_tools-2011.11.20.535097_unRaid5.0beta14-i686-5Zeron.plg 392

plex-media-server_mod.plg

sabnzbd_mod.plg

sickbeard_mod.plg

Link to comment

For the start issue, I've had luck with waiting for the cache drive to mount using this string:

 

# determine if cache drive online, retry up to 7 times
for i in 0 1 2 3 4 5 6 7
do
    if [ ! -d /mnt/cache ]
    then
      sleep 10
    fi
done

# If Cache drive is online
if [ -d /mnt/cache ]; then
blah blah blah
fi

 

I have a much more convoluted process with rc. scripts and other calls I've set up over the last year or so with a lot of help in the forums to try to shut down my various add ons to allow for a clean unmounting of the array (which would take me a long time to write up, and I don't have enough time... but here are some commands that may help).

 

This is looped into /usr/local/sbin/emhttp_event upon array restart or shutdown...

 

if ps -ef | grep sickbeard | grep -v grep; then
                                /usr/bin/wget -q --delete-after "http://localhost:8081/home/shutdown/"
                                logger -t SickBeard Stopped
if ps -ef | grep sabnzbd | grep -v grep; then
                                /usr/bin/wget -q --delete-after "http://192.168.1.10:8082/sabnzbd/api?mode=shutdown&ma_username=username&ma_password=yourpassword&apikey=yourapikey"
                                logger -t SABnzbd Stopped

 

I'll try to do a more thorough writeup if it would be helpful.

Link to comment

Thanks for the hints.

I'll look at how to do this.. 

 

Does the script to check if the cache is mounted go into the the 'go' script? 

Before or after the call to start emhttpd ? 

 

Or better question .. What initiates the plugin/app startup process?  Is it emhttpd? 

 

 

Link to comment

Well .. found those event handlers,and some of the plugins have registered routines there.

But it doesn't look like unraid invokes them. 

I haven't found any way to have apps automatically start/stop without hanging the array at boot or shutdown.

 

For me, the plug-in system seems like it needs work.  It should not require this much effort to simply start and stop applications cleanly and boot and shutdown.  There are many threads talking about this.. I'm not alone.

 

I will go back to running my apps on a Windows server under ESXi.   

It's reliable, but a little slow moving large files to/from the video directories for Plex/Sickbeard.   

 

Thanks for the help Kaiguy, much appreciated.

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.