1

I have a script on the PI to shutdown my NAS "shutdown_nas.sh". I have created that script in /etc/init.d according to the instructions in /etc/init.d/README

It is symlinked in /etc/rc0.d/K01NAS_shutdown.sh

It works fine when I call:

sudo service shutdown_nas.sh stop

It also works fine when I halt the PI when I'm on ethernet (eth0).

It doesn't work on WIFI only, it seems like wlan is down before the needed request is done.

4
  • I think you need a higher runlevel. Try /etc/rc2.d/K01NAS_shutdown.sh, or /etc/rc3.d/K01NAS_shutdown.sh
    – Gerben
    Commented May 21, 2014 at 11:10
  • I fail to see that. It should run on shutdown, rc0.d. en.wikipedia.org/wiki/Runlevels
    – Janghou
    Commented May 21, 2014 at 12:30
  • I don't really understand runlevels that well. Reading a bit more, I think you're right. Is K01... the first file in the rc2.d directory? Is there a K00.. that messes thins up?
    – Gerben
    Commented May 21, 2014 at 14:21
  • 1
    No, and the script does work (mutatis mutandis) on a Ubuntu 14.04 laptop, so it must be a RPI thing. Maybe because the dongle is on a USB-hub
    – Janghou
    Commented May 22, 2014 at 18:56

1 Answer 1

1

Change the sequence number of your service so it is called before the wifi service.

man update-rc.d

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.