Custom init script preventing 'reboot' from working

Newer user OpenWRT, but I would consider myself fairly fluent in linux. I'm having SOOO much fun trying to convert an x86_64 box into my home router, replacing all of my AT&T gigabit modem...

One of the steps I need to do is install wpa_supplicant program (available via opgk), install some config files (i'm building this with imagebuilder), creating a custom init script, and then having it run on boot. (For those curious, this fakes out the AT&T ONT. Another topic...)

Everything is working great, but when I go to "reboot" the router, it does nothing. I've narrowed it down to my init script:

#!/bin/sh /etc/rc.common
START=99
start() {
	echo start
	wpa_supplicant -D wired -i eth1 -c /etc/config/auth/wpa_supplicant.conf
}

I figure something is holding off reboot. Can someone point me in the right direction here?

Try adding a "-B" parameter, so "wpa_supplicant" keeps running in the backgroud, but the script terminates.

2 Likes

… or even better, convert it to a proper procd init script, so that procd can supervise the wpa_supplicant process.

Minimal example:

Just replace the command line with your wpasupp invocation

4 Likes

Thanks for the replies!

I see procd has quite a few benefits. should all start up and init scripts be procd? What’s the difference if started by procd?

I spent some time reading about procd last night. It's really cool! What a neat and powerful tool OpenWRT has!

I'm going to write up an init script now to test it out.

Alright, PROCD FTW. I rewrote it in procd, and it's working beautifully now. It even respawns if it is killed, and reboots work great.

#!/bin/sh /etc/rc.common
 
USE_PROCD=1
START=95
 
start_service() {
    procd_open_instance
    procd_set_param command wpa_supplicant -D wired -i eth1 -c /etc/config/auth/wpa_supplicant.conf
    procd_set_param respawn
    procd_set_param stdout 1
    procd_set_param stderr 1
    procd_close_instance
}

Marking as solved.

Thanks again

1 Like

This topic was automatically closed 10 days after the last reply. New replies are no longer allowed.