I searched and nothing worked... I'm new in the rasp and linux, so I don't know much...
Thank you

Code: Select all
# update boot / reboot files
cp <your script> /etc/init.d/
# do it as soon as the device is going down,
# both for shutdown and reboot
update-rc.d /etc/init.d/<your script> defaults
Code: Select all
#! /bin/sh
### BEGIN INIT INFO
# Provides: <your script name>
# Required-Start: $all
# Required-Stop:
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: Manage my cool stuff
### END INIT INFO
PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/opt/bin
. /lib/init/vars.sh
. /lib/lsb/init-functions
# If you need to source some other scripts, do it here
case "$1" in
start)
log_begin_msg "Starting my super cool service"
# do something
log_end_msg $?
exit 0
;;
stop)
log_begin_msg "Stopping the coolest service ever unfortunately"
# do something to kill the service or cleanup or nothing
log_end_msg $?
exit 0
;;
*)
echo "Usage: /etc/init.d/<your script> {start|stop}"
exit 1
;;
esac
Code: Select all
cp <your script> /etc/init.d/
Code: Select all
#! /bin/sh
### BEGIN INIT INFO
# Provides: <your script name>
# Required-Start: $all
# Required-Stop:
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: Manage my cool stuff
### END INIT INFO
PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/opt/bin
. /lib/init/vars.sh
. /lib/lsb/init-functions
# If you need to source some other scripts, do it here
case "$1" in
start)
log_begin_msg "Starting my super cool service"
# do something
log_end_msg $?
exit 0
;;
stop)
log_begin_msg "Stopping the coolest service ever unfortunately"
# do something to kill the service or cleanup or nothing
log_end_msg $?
exit 0
;;
*)
echo "Usage: /etc/init.d/<your script> {start|stop}"
exit 1
;;
esac
Code: Select all
#!/bin/sh
sudo service hostapd stop
sudo service udhcpd stop
sudo service hostapd start
sudo service udhcpd start
Code: Select all
service hostapd stop
service udhcpd stop
service hostapd start
service udhcpd start
Code: Select all
#! /bin/sh
### BEGIN INIT INFO
# Provides: </home/pi/hotspot>
# Required-Start: $all
# Required-Stop:
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: Manage my cool stuff
### END INIT INFO
PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/opt/bin
. /lib/init/vars.sh
. /lib/lsb/init-functions
# If you need to source some other scripts, do it here
case "$1" in
start)
log_begin_msg "Starting my Hotspot service"
service hostapd stop
service udhcpd stop
service hostapd start
service udhcpd start
log_end_msg $?
exit 0
;;
stop)
log_begin_msg "Stopping the Hotspot service unfortunately"
# do something to kill the service or cleanup or nothing
log_end_msg $?
exit 0
;;
*)
echo "Usage: /etc/init.d/home/pi/hotspot {start|stop}"
exit 1
;;
esac
Code: Select all
cp <your script> /etc/init.d/
update-rc.d /etc/init.d/<your script> defaults
Code: Select all
cp /home/pi/hotspotboot /etc/init.d/
update-rc.d /etc/init.d/home/pi/hotspotboot defaults
Code: Select all
root@raspberrypi:/home/pi# cp /home/pi/hotspotboot /etc/init.d/
root@raspberrypi:/home/pi# update-rc.d /etc/init.d/home/pi/hotspotboot defaults
update-rc.d: using dependency based boot sequencing
update-rc.d: error: unable to read /etc/init.d//etc/init.d/home/pi/hotspotboot
Code: Select all
cp /home/pi/hotspotboot /etc/init.d/
cd /etc/init.d/
update-rc.d hotspotboot defaults
Code: Select all
oot@raspberrypi:/etc/init.d# update-rc.d hotspotboot defaultsupdate-rc.d: using dependency based boot sequencing
update-rc.d: warning: default start runlevel arguments (2 3 4 5) do not match hotspotboot Default-Start values ( 2 3 4 5)
update-rc.d: warning: default stop runlevel arguments (0 1 6) do not match hotspotboot Default-Stop values ( 0 1 6)
insserv: script hotspotboot is not an executable regular file, skipped!
insserv: warning: script 'mathkernel' missing LSB tags and overrides
Code: Select all
insserv: script hotspotboot is not an executable regular file, skipped!
Code: Select all
cd /etc/init.d
sudo chmod u+x hotspotboot
update-rc.d hotspotboot defaults
Code: Select all
insserv: missing valid name for `Provides:' please add.
To which post are you referring?Biruntha wrote:what you mentioned <your script>. is it python script?
second postDirkS wrote:To which post are you referring?Biruntha wrote:what you mentioned <your script>. is it python script?
Keep in mind that you're responding to a topic that's a year and a half old...
Code: Select all
# Provides: </home/pi/hotspot>
Code: Select all
# Provides: hotspot