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.

[SOLVED]What file do i edit to terminate services when i press "stop"

Featured Replies

Hello,

 

on unraid 5, when I press the "stop" button what file does it use to stop the array and unmount all the drives?

 

I have a couple of items i'd like to stop in order of a proper unmount.

I edited the file rc.unRAID under "stop" but that didn't do the trick.

 

Is there another file i need to edit to kill certain services when i press stop?

Hello,

 

on unraid 5, when I press the "stop" button what file does it use to stop the array and unmount all the drives?

 

I have a couple of items i'd like to stop in order of a proper unmount.

I edited the file rc.unRAID under "stop" but that didn't do the trick.

 

Is there another file i need to edit to kill certain services when i press stop?

It does it from within emhttp.

 

There is a "stop" event though, but you need scripts as it is expecting in the right directory structure to have them invoked.  (I do not know the structure off-hand, sorry... 

 

The event you want is the pre-stop event that exists in later 5.0 betas, so your program can stop before the attempt to unmount the drives occur.

  • Author

Thanks for the response.

 

I have beta 14 running.

 

in /usr/local/emhttp/plugins/webGui i don't see a pre-stop script

 

Is this something I will have to build manually?

 

 

Finally, how does cache_dirs shutdown properly when I press stop?

  • Author

Hi,

 

So far, I looked at the logs and it seems like the stop even first calls on this:

 

Jan 29 10:34:43 kenny emhttp: shcmd (58): /usr/local/sbin/emhttp_event stopping_svcs
Jan 29 10:34:43 kenny emhttp_event: stopping_svcs
Jan 29 10:34:43 kenny emhttp: shcmd (59): ps axc | grep -q rpc.mountd
Jan 29 10:34:43 kenny emhttp: _shcmd: shcmd (59): exit status: 1
Jan 29 10:34:43 kenny emhttp: Stop SMB...
Jan 29 10:34:43 kenny emhttp: shcmd (60): /etc/rc.d/rc.samba stop |& logger
Jan 29 10:34:43 kenny emhttp: Spinning up all drives...
Jan 29 10:34:43 kenny emhttp: Sync filesystems...

 

I looked at the emhttp_event file in /usr/local/sbin/ and the file seems "empty".

What i mean, it's all hashed out.

 

I am itnerested in this part of the file:

 

# stopping_svcs
#   Occurs during cmdStop execution.
#   Nothing has actually been stopped yet, about to stop network services.

 

But i don't know how to edit it or add items to it.

 

I did a search but i can't filter through it because emhttp_event shows up in logs so it revealed way too many results.

The wiki shows that it was introduced in Beta2 but there are not entries on how to use the file.

  • Author

Hello,

 

anyone know how to call emhttp_event or how to accomplish what i need to do?

  • Author

I seem to have it figured out.

 

Gotta unhash "Stopping_svcs" and anything below it will run. I guess the same is true for any other event.

 

So I have my go script that looks like this;

 

sed -i  "/to stop network services./a /etc/rc.d/unraid.d/rc.unraid_swapfile stop" /usr/local/sbin/emhttp_event

sed -i  "/to stop network services./a /etc/rc.d/unraid.d/rc.unraid_mysqld stop" /usr/local/sbin/emhttp_event

sed -i  "/to stop network services./a stopping_svcs" /usr/local/sbin/emhttp_event

 

It does the trick, now anytime i press the stop button, i don't have to telnet in and manually stop those processes.

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.