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

1.0.3 still doesn't shut down my computer

 

i find it very weird because with this powerdown script or unraid somehow unmount its disks without stopping the programs like couchpotato and so on

or it first stops them unmounts the disks and then restarts the programs

 

fact is that with this script the disks unmount.... but the server never powers down ....

 

if i push stop in the gui then the programs stop... disks unmount and the programs never restart ... until i press start again....

also pushing the powerdown button in the gui stops the server as expected .....

 

2 syslogs attached

 

syslog.zip is stoped the server by pushing stop... wait for the disks to unmount and then powerdown in the gui

syslog07112013.zip contains 2 logs

- syslog-sbin.powerdown.txt is after cron invoked /sbin/powerdown with the 1.0.3 powerdown script installed

- syslog-sbin.poweroff is after a few minutes when the server won't shut down then i just invoked /sbin/poweroff in the CLI as the disks were unmounted ....

logs.zip

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

I noticed a problem in my modified powerdown script. The rc.d scripts were called without a path, which propably rendered the whole mod useless. Attached is a fixed version.

 

To trick unmenu into installing it on boot rename it to powerdown-1.02-noarch-unRAID.tgz, backup the original and replace it with the new version.

 

@sacretagent

Please give it another try with the new version. I found nothing in your syslogs that gives me a hint at why the systems hangs. But I'm not very good at reading these logs.

 

edit: urg... it still doesn't work as I expect it to do. So the download is withdrawn for now. Sorry.

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.?)

 

Man, I just came on here to report this. I noticed the issue when I had a power outage a couple of weeks ago. Apcupsd called the powerdown script. The array was stopped, but the server never turned off.

 

I did some further testing last night. The powerdown script only kills active pid's for the data drives and then unmounts them. The shutdown command says it is halting the system but fails. It doesn't stop or kill any other plugins that may be accessing the cache drive.

 

When I try to shut down through the new gui, it first stops (not kill) all plugins running, including virtualbox (I guess it uses the stop option on all rc.X present), then stops the array. When I click shutdown, it successfully shuts it down.

 

I am wondering what scripts the new gui uses for shutdown because it is very clean and whether I can tie those to the apcupsd plugin

  • Author

I am wondering what scripts the new gui uses for shutdown because it is very clean and whether I can tie those to the apcupsd plugin

 

 

Don't install the powerdown package and call the unRAID power down command in the same location.

See how that works.

 

The original purpose of the powerdown package was a failsafe for a safer powerdown.

 

Now that there is a supported plugin architecture and events, I question the need for the powerdown package.

 

We can have the powerdown utility call the unRAID powerdown command.

Set a timer of say 3 minutes, then stop the list of scripts in rc.d and start killing processes on the array as a last resort.

As long as the shutdown depends on emhttp IMHO we are in clear need of an alternative method. Whenever emhttp crashes (and that happens quite often, if one takes the forum posts as an indication) the user is stranded without a way of easily and cleanly shutting down. I know in the most cases this is due to malfunctioning plugins and not the fault of core unraid.

 

But either way I think the shutdown should be more failsafe and foolproof as it is at the moment.

 

Just my 2 cents.

Whenever emhttp crashes the user is stranded without a way of easily and cleanly shutting down.

 

What if we had a restart emhttp script? That would void the need for 80% of my restarts personally. I only need restarts when I mess with plugins. I left my server alone for a while and had 200+ days of uptime. went to go try to install xyz, bam. reboot needed.

I am wondering what scripts the new gui uses for shutdown because it is very clean and whether I can tie those to the apcupsd plugin

 

 

Don't install the powerdown package and call the unRAID power down command in the same location.

See how that works.

 

The original purpose of the powerdown package was a failsafe for a safer powerdown.

 

Now that there is a supported plugin architecture and events, I question the need for the powerdown package.

 

We can have the powerdown utility call the unRAID powerdown command.

Set a timer of say 3 minutes, then stop the list of scripts in rc.d and start killing processes on the array as a last resort.

 

I looked at the original unraid powerdown script, and unfortunately it just calls the emhttp and the webgui needs to be running and listening on port 80 in order to perform its function. So it is useless if gui is not running.

 

Here's the code:

 

#!/bin/bash
#
# Helper script to gracefully power-down unRAID server.
# Works only if webGui is running and listening on port 80.

# Access a blank page in case this is first request since startup.
/usr/bin/wget -q -O - localhost/update.htm >/dev/null

# Have emhttp do all the work as if user clicked 'shutdown' in webGui.
/usr/bin/wget -q -O - localhost/update.htm?shutdown=apply >/dev/null

 

So, SlrG is correct and I'll go ahead and give his custom script a try

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.?)

 

Man, I just came on here to report this. I noticed the issue when I had a power outage a couple of weeks ago. Apcupsd called the powerdown script. The array was stopped, but the server never turned off.

 

I did some further testing last night. The powerdown script only kills active pid's for the data drives and then unmounts them. The shutdown command says it is halting the system but fails. It doesn't stop or kill any other plugins that may be accessing the cache drive.

 

When I try to shut down through the new gui, it first stops (not kill) all plugins running, including virtualbox (I guess it uses the stop option on all rc.X present), then stops the array. When I click shutdown, it successfully shuts it down.

 

I am wondering what scripts the new gui uses for shutdown because it is very clean and whether I can tie those to the apcupsd plugin

 

This is exactly what i am seeing.. and try to explain for months :)

SirG let me know if i need to test :)

I also would like an emhttp restart script. :) But I think it is out of my league to write one that would work reliably. :)

I also would like an emhttp restart script. :) But I think it is out of my league to write one that would work reliably. :)

 

Based on my memory from comments past, it is simply not possible.  I gotta say, if there was ever a wishlist item to be added to Tom's list it would be a more resilient and restartable emhttp.  My memory also tells me he mentioned working on a whole new paradigm for the GUI so that just scratch the itch.

Here is the fixed version. All credits go to the original author. I merely added some lines.

 

Good news,

 

The server shut down clean and proper, all plugins stopped first and the machine powered off. I did this through the apcupsd, I simply cut off power to the ups and triggered the powerdown.

 

However, even though it was set in the settings, the ups was not shut down. I'm investigating that. . .

how do I replace the one that was there before with this one?

the apcupc plugin have the powerdown function embedded, so the plugin needs to be updated, or am I wrong ?

 

//Peter

how do I replace the one that was there before with this one?

 

The easiest way is to rename your original powerdown-1.02-noarch-unRAID.tgz to powerdown-1.02-noarch-unRAID.bak

and rename the new one powerdown-1.04-noarch-unRAID.tg to powerdown-1.02-noarch-unRAID.tgz and copy over to your unraid

 

Once it is proven to work we can ask Joe to upgrade the package in unmenu

 

 

 

 

 

how do I replace the one that was there before with this one?

 

The easiest way is to rename your original powerdown-1.02-noarch-unRAID.tgz to powerdown-1.02-noarch-unRAID.bak

and rename the new one powerdown-1.04-noarch-unRAID.tg to powerdown-1.02-noarch-unRAID.tgz and copy over to your unraid

 

Once it is proven to work we can ask Joe to upgrade the package in unmenu

I can do that, once proven, HOWEVER, he said he is using the one in the APCUPSD plugin, not the one from unMENU's package manager.

I have nothing to do with the plugin.

 

Joe L.

To clarify,

 

the apcupsd plugin (plg, not conf) downloads and installs the same script as the one from unmenu. But I did not install it from unmenu. So Joe is right, in order for it to update for me, the apcupsd plugin would have to be updated.

 

 

Anyway, after I tested it a couple of times successfully last night, started it back up and went to bed.

 

This morning, the server was off (to my surprise). I turned it on and it started a parity check. No power failure happened last night (microwave clock still correct). The ups unit was still on and batteries charged as well.

 

Of course, no syslog since the last time it was successfully turned off. This never (not once) happened to me before. I am investigating to fins out whether it has something to do with the script.

 

Only thing I know right now is that whatever happened, happened before the mover ran at 3:40am

 

Oh and yes, the server was turned on when I went to bed, I am not imagining things. The last syslog shows shut down at 11:41pm. But couchpotato log shows another restart at 11:45pm and further activity up until past midnight.

well no weird behavior for me so far

He turned succesfully off at 01:30 AM with Cron (first time in months :) )

i looked through the syslog and all seems fine

 

For me this is a winner

To clarify,

 

the apcupsd plugin (plg, not conf) downloads and installs the same script as the one from unmenu. But I did not install it from unmenu. So Joe is right, in order for it to update for me, the apcupsd plugin would have to be updated.

 

 

Anyway, after I tested it a couple of times successfully last night, started it back up and went to bed.

 

This morning, the server was off (to my surprise). I turned it on and it started a parity check. No power failure happened last night (microwave clock still correct). The ups unit was still on and batteries charged as well.

 

Of course, no syslog since the last time it was successfully turned off. This never (not once) happened to me before. I am investigating to fins out whether it has something to do with the script.

 

Only thing I know right now is that whatever happened, happened before the mover ran at 3:40am

 

Oh and yes, the server was turned on when I went to bed, I am not imagining things. The last syslog shows shut down at 11:41pm. But couchpotato log shows another restart at 11:45pm and further activity up until past midnight.

 

the apcupsd plugin is updated.. joe just never pushed out the update. i updated it so it will install the shutdown script if you have it installed.. otherwise it falls back to just use the one that came with unraid 5

  • 3 weeks later...

been testing this out. the new version did not shut down for me last night. it did on previous nights. it only stopped the array this time.

Well, I had a GUI crash and called the powerdown but it stopped at some point...

I had to push the reset button.

Next post contains the second part of the syslog.

(The size limitation is really crap!)

will zip it next time

 

Edit:

Found out the syslog is the wrong one.

Resetting via the button prevented from saving the syslog.

It was about the same time but the wrong day...  :-[

sry

...

(The size limitation is really crap!)

Try zipping it next time. Both of your syslogs together compress to only 38 KB

  • 3 weeks later...

On my V5.0.2 the installed powerdown (1.02) did not work anymore as well. I used to enter 'powerdown -r now'.

It did stop some stuff but after a few minutes the root prompt came back, webgui was gone, and the machine did NOT shut down or reboot. Had to manually shut it down...

I know i can do all of this from the webgui by hand, stop the array etc, but what if the power fails and my UPS needs to bring the system down unattended?

 

I've now replaced the 1.02 powerdown with the 1.04 one, and ran 'installpkg' on it, is that correct?

Will it now be used and re-installed every time i reboot?

Do i have to delete the powerdown-1.02-noarch-unRAID.tgz.auto_install file from /packages?

 

How can i make sure 1.04 is installed & working?

The simplest way at the moment is to rename it to 1.02 and replace the "older" package with the new one. That way unmenu will install the new one thinking it is the old. For it to work make sure you don't delete the auto_install file!

 

Running installpkg is correct if you want to install it without rebooting your server.

 

To make sure the correct one is installed and working run it from a shell window. 1.04 will start with shutting down your plugins. Every plugin will be called with a stop command. You will see it on screen. Afterwards the shutdown continues in the same way as the older version did.

Ok, the 1.04 version of powerdown seems to work :)

It stopped all plugins, and then rebooted, as expected.

 

Good work people!

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.