Skip to content
View in the app

A better way to browse. Learn more.

Unraid

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

New powerdown script needed for 5.0 unRAID

Featured Replies

ok why is this old script "working" on garycase setup and not on mine ?

don't understand that ...

 

 

You may need to re-engineer your system so that addons/plugins gracefully shutdown via the rc scripts.

This script is hooked into those also

 

How is virtual box started and shutdown?

 

Maybe it needs to use the emhttp event system, or a script for it needs to be put there.

 

The power down script is a last ditch effort.

While it's been safe for all these years, the complexity of various configurations makes it difficult.

 

I can add a hook to call unRAID's original powerdown script or not replace it at all.

 

However, I'm not sure how to deal with all the other addons and plugins that people use.

 

If there are apps mounted on an array disk, emhttp is going to hang and retry until that is satisfied.

Which means, that the apps using array disks, need to really be part of emhttp events.

 

What happens if you don't install the powerdown script?

 

Hi Weebootech

 

virtualbox has it own stop script -> /etc/rc.d/rc.virtualbox stop

 

 

when i don't install the script and do following

 

1. disable swap (which i really would also like a new version for...  so that it disables when you stop the array)

2. stop the array

3. confirm to stop the server

4. push the stock power down button in the gui

 

then stop the array takes a while.. and most of the time i need to do a few killall find to let it unmount all drives if i don't so that then find keeps some disks spinning

but once i see all disks are unmounted and the click the power down button in the gui then the server stops normally

 

i have asked already in  few posts is there a command we can use to disable the array ... aka the command that is used when we push the stop button in the gui ....

i think if that one can be adapted for cache dirs , find threads to be killed then we are golden

or adapt cache dirs so when we do a -q that all open find threads are killed off .....

cause it seems to be find that is keeping my disks busy

 

 

 

Update installed THEONE's swap file plugin as it also has a rc.d/rc.swapfile stop script

so no  need to kill swap file any more

 

  • Replies 149
  • Views 39k
  • Created
  • Last Reply
  • Author

There is a command that can be used to stop the array via the powerdown button on the gui.

In the older methodolgy of my powerdown package, that was renamed.

Perhaps I'll update it so I do not rename it, but in fact call it or let myself be called by the shutdown logic.

 

 

How is cachedirs stopped? How should it be stopped?

That's probably be a question for Joe L.

perhaps that needs to be part of the shutdown scripts and/or event system too.

 

Does virtual box put itself into the local shutdown scripts?

 

 

 

i will let "theone" answer that question

 

Does virtual box put itself into the local shutdown scripts?

 

 

cachedirs stops with cachedirs -q ....

but i asked in the cache dirs thread if we can also kill the finds it spawns.....

 

 

i will let "theone" answer that question

 

Does virtual box put itself into the local shutdown scripts?

 

 

cachedirs stops with cachedirs -q ....

but i asked in the cache dirs thread if we can also kill the finds it spawns.....

When I originally wrote cache_dirs, I attempted exactly that.  To kill the "find" currently in progress.  It was, at that time, un-killable.    (never did figure out why, but it caused more problems than it solved.  It ended up locking up and never returning.)

 

Since any given "find" "should" take a fraction of a second (assuming everything is in the disk buffer cache) the main loop of cache_dirs "should" terminate very quickly when it finds the lock file it is looking for is missing.

 

The question is... why are the "find" commands taking so long that this is an issue at all?

 

Many years have passed, so perhaps the current kernel is more likely to let it be killed.

 

run it in the foreground and in verbose mode to see what it is doing.

cache_dirs -F -v

 

Joe L.

i will let "theone" answer that question

 

Does virtual box put itself into the local shutdown scripts?

 

 

yes

  • Author

i will let "theone" answer that question

 

Does virtual box put itself into the local shutdown scripts?

 

 

yes

 

Maybe the powerdown script needs to make sure it is the last thing called.

ok weebotech

 

I have no more clean powerdown installed

i changed the unmenu swap file for the plugin 5.0 script

on recommendation of Joe did i remove -m 5 from the cache dirs startup parameters

this evening i did following

 

just clicked stop array

waited like 3 minutes till the array stopped and all disks unmounted

clicked stock power down button in the gui

 

and yes the server shut down after like 4 minutes ....

 

so how do we translate this now into a set of commands that we can put in a cron job ?

and i would prefer to do it in commandline style (script) instead of calling url's just in case the emhttp is stalled for any reason that we still can shutdown the server....

 

  • Author

 

so how do we translate this now into a set of commands that we can put in a cron job ?

and i would prefer to do it in commandline style (script) instead of calling url's just in case the emhttp is stalled for any reason that we still can shutdown the server....

 

I think the URLS have to be called.

From what I've seen, emhttp is wiggin' out when the filesystems get umounted from underneath.

 

Plus there is supposed to be a whole event subsystem that 'should' be called.

 

If only a kill -TERM were caught by emhttp and it defaulted to an emergency array shutdown......

hmmmm.......

 

 

for the powerdown script we might be able to put in a fail safe timer so that if after 3-5 minutes, we'll start

killing processes anyway.

umounting anyway.

stopping the array anyway.

let me know when you want to test something ....

last 2 nights i stopped the server manually by doing as above and no issues

but i would like it to go by cron ASAP

 

for the powerdown script we might be able to put in a fail safe timer so that if after 3-5 minutes, we'll start

killing processes anyway.

umounting anyway.

stopping the array anyway.

 

yes. i still every once in a while will get 'Retry unmounting shares...' continually even though nothing seems to be accessing the disks. obviously something is though. i can usually only get it to shutdown using the powerdown script when that happens. maybe unraid itself should have this feature when trying to stop the array, although that seems like it could cause potential issues.

i can also help test some. i have an unraid VM i use just for testing.

bump...

i hope somebody is looking into this?

IF not

 

what would be the way to call the right urls?

what are the urls?

1. to stop array?

2. To powerdown ?

 

how to put this in a cron job ?

 

  • 3 weeks later...

What is the difference between the VMware tools script that does a shutdown and the APC powerdown script??

  • 1 month later...

Sooo any more progress on this now that we have a 5.0-Final???

  • 3 weeks later...

I have also just updated to 5.0 now that it is official and am wondering what the status is here?  Can I carry on using the old powerdown script (which I've been using for the last 5 years or so)?

 

Thanks.

I have also just updated to 5.0 now that it is official and am wondering what the status is here?  Can I carry on using the old powerdown script (which I've been using for the last 5 years or so)?

 

Thanks.

the old script will work just fine.

I have also just updated to 5.0 now that it is official and am wondering what the status is here?  Can I carry on using the old powerdown script (which I've been using for the last 5 years or so)?

 

Thanks.

the old script will work just fine.

 

Ok great Joe, all seems to be working fine.

 

Is the original package still hosted on Google Code somewhere as I would like to install this without reliance on Unmenu (through which I believe it is currently installed)?

 

Thanks.

How can I check, if "clean powerdown" works?

 

I installed the script and it seems to work - at least the console output is another than the one of "shutdown".

After issuing the "powerdown" command I see some smartctl output and the server goes down eventually. (any hint how I can capture this output?)

The script is very useful and vital in case that the GUI is unresponsive but I would suggest to

modify it to be more informative on the console.

I mean it would be good to see a feedback what's going on if you call "powerdown".

Just give the user some response.

e.g.

powerdown initiated - script by joel
press ctrl+c to abort 5...4....3...2...1...
stopping array...
unmounting drives...
saving logfiles...
server going down

 

Since this script is usually called in an emergency or if a problem occurs, it may be of interest

to save the syslog.

 

What's your opinion on this?

 

I have also just updated to 5.0 now that it is official and am wondering what the status is here?  Can I carry on using the old powerdown script (which I've been using for the last 5 years or so)?

 

Thanks.

the old script will work just fine.

 

Agree ... certainly works fine for my system anyway.

 

  • 1 month later...

Well for my 5.0 system the powerdown script stopped working. :(

 

It is doing some things but it does not turn of the pc anymore. Some plugin/s is/are holding it up. As most plugins (I know) have a rc.d control script that has a stop parameter, I thought why not call this for all non stock rc.d scripts to make the plugins shutdown gracefully before trying to pull the rug from under their feet.

 

I modified the original plugin to do so. Please test and feel free to incorporate in the original version if you like it. (Joe L.?)

powerdown-1.03-noarch-unRAID.zip

Well for my 5.0 system the powerdown script stopped working. :(

 

It is doing some things but it does not turn of the pc anymore. Some plugin/s is/are holding it up. As most plugins (I know) have a rc.d control script that has a stop parameter, I thought why not call this for all non stock rc.d scripts to make the plugins shutdown gracefully before trying to pull the rug from under their feet.

 

I modified the original plugin to do so. Please test and feel free to incorporate in the original version if you like it. (Joe L.?)

 

changelog?

 

EDIT: that is to say, an idea of the lines of code added/deleted/changed?

  • Author

 

Here's a quick diff.

 

I do have this on google code in svn.

if you have a gmail/googlecode account I could add your account so you can checkin the changes.

 

diff -ur powerdown-1.02/etc/rc.d/rc.unRAID powerdown-1.03/etc/rc.d/rc.unRAID
--- powerdown-1.02/etc/rc.d/rc.unRAID   2008-10-04 16:00:42.000000000 -0400
+++ powerdown-1.03/etc/rc.d/rc.unRAID   2013-11-05 15:35:49.000000000 -0500
@@ -2,7 +2,7 @@

<SNIP>

# Stop unraid:
-unRAID_stop() 
+unRAID_stop()
{
+    # lines added by SlrG
+    logger "Stopping Plugins."
+    comm -13 <(sort -u < "/etc/rc.d/rcdstock") <(ls -- "/etc/rc.d") | while read line ; do echo Sending \"$line stop\"; $line stop ; done
+    # end of lines added by SlrG
+
     logger "Stopping unRAID."
    
Only in powerdown-1.03/etc/rc.d: rcdstock
root@unRAID:/tmp# more powerdown-1.03/etc/rc.d/rcdstock 
#stock powerdown protected rc.d scripts
rc.0
rc.4
rc.6
rc.K
rc.M
rc.S
rc.acpid
rc.atalk
rc.avahidaemon
rc.avahidnsconfd
rc.fuse
rc.ifplugd
rc.inet1
rc.inet1.conf
rc.inet2
rc.inetd
rc.local
rc.messagebus
rc.nfsd
rc.ntpd
rc.rpc
rc.samba
rc.syslog
rc.sysvinit
rc.udev
#additional powerdown protected rc.d scripts
rcdstock
rc.apcupsd
rc.local_shutdown
rc.unRAID

 

A while back I worked on some other changes suggested by a member.

I stopped after making a number of suggested changes and when I asked the person to test them out he balked at me.

So I do have other changes to incorporate if people are willing to work with me and test it.

 

The rcdstock input file should probably not be in that directory.

It could be in the /boot/config directory or in /etc.

Data files shouldn't be in the /etc/rc.d directory.

 

Also the way the slackware packages usually work is they install conf files in etc as filename.new

If a config file does not exist, the .new is renamed to the basename, otherwise it is left as is to avoid overwriting the existing file.

 

Check the doinst.sh script.

 

define "work with me and test it"  I might be willing, assuming I'm able.

I'm also willing to test. :)

 

You are right regarding the file in the rc.d directory. I thought it easier to modify however if it is in the same place as the scripts it allows/disallows to be stopped. It dosn't need to be a seperate file either. The list could be implemented into the rc.unRAID script itself. But again I found it easier and more understandable to have a seperate file.

 

Please just see it as a proof of concept. I'm not set on any of the inner workings as long as in the end my system really powers down. :)

i can test too

mine is snot shutting down now anyway with the 1.02 version

just installed 1.03 will see at 00:30 is he shuts down tonight

 

 

 

Archived

This topic is now archived and is closed to further replies.

Account

Navigation

Search

Search

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.