mirror of
https://github.com/netfun2000/raspberry-wifi-conf.git
synced 2026-02-27 09:45:16 +08:00
add service to allow for start / stop / on boot starting of the wifi conf app
This commit is contained in:
10
README.md
10
README.md
@@ -20,6 +20,16 @@ $sudo npm run-script provision
|
||||
$sudo npm start
|
||||
```
|
||||
|
||||
## Setup the app as a service
|
||||
|
||||
There is a startup script included to make the server starting and stopping easier. Do remember that the application is assumed to be installed under `/home/pi/raspberry-wifi-conf`. Feel free to change this in the `assets/init.d/raspberry-wifi-conf` file.
|
||||
|
||||
```sh
|
||||
$sudo cp assets/init.d/raspberry-wifi-conf /etc/init.d/raspberry-wifi-conf
|
||||
$sudo chmod +x /etc/init.d/raspberry-wifi-conf
|
||||
$sudo update-rc.d raspberry-wifi-conf defaults
|
||||
```
|
||||
|
||||
#### Gotchas
|
||||
|
||||
The `hostapd` application does not like to behave itself on some wifi adapters (RTL8192CU et al). This link does a good job explaining the issue and the remedy: [Edimax Wifi Issues](http://willhaley.com/blog/raspberry-pi-hotspot-ew7811un-rtl8188cus/). The gist of what you need to do is as follows:
|
||||
|
||||
30
assets/init.d/raspberry-wifi-conf
Normal file
30
assets/init.d/raspberry-wifi-conf
Normal file
@@ -0,0 +1,30 @@
|
||||
#! /bin/sh
|
||||
# /etc/init.d/raspberry-wifi-conf
|
||||
|
||||
### BEGIN INIT INFO
|
||||
# Provides: raspberry-wifi-conf
|
||||
# Required-Start: $local_fs $syslog $network
|
||||
# Required-Stop: $local_fs $syslog
|
||||
# Default-Start: 2 3 4 5
|
||||
# Default-Stop: 0 1 6
|
||||
# Short-Description: Script to ensure wifi connectivity
|
||||
# Description: A NodeJS application to ensure Wifi connectivity by setting the RPI as an AP if needed
|
||||
### END INIT INFO
|
||||
|
||||
# Carry out specific functions when asked to by the system
|
||||
case "$1" in
|
||||
start)
|
||||
echo "Starting raspberry-wifi-conf service"
|
||||
cd /home/pi/raspberry-wifi-conf
|
||||
sudo /usr/bin/node server.js > service.log
|
||||
;;
|
||||
stop)
|
||||
echo "Stopping raspberry-wifi-conf service"
|
||||
;;
|
||||
*)
|
||||
echo "Usage: /etc/init.d/raspberry-wifi-conf {start|stop}"
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
|
||||
exit 0
|
||||
Reference in New Issue
Block a user