How to start webiopi_custom at startup as service

1,155 views
Skip to first unread message

Pablo Osuna

unread,
Jan 27, 2013, 4:18:42 AM1/27/13
to web...@googlegroups.com
Hello. I´m trying to run the webiopi_custom.py as a service at startup. I just can run it as service with  sudo ./webiopi_custom.daemon start but at startup the service do no run again. Adding sudo update-rc.d webiopi defaults just run the default webiopi page. May you tell how to solve this. Thanks in advance. Pablo.

trouch

unread,
Jan 27, 2013, 10:10:23 AM1/27/13
to Pablo Osuna, web...@googlegroups.com
Hi

First, edit webiopi_custom.daemon to change two lines :
# Provides:          webiopi
to
# Provides:          webiopi_custom
and
NAME=webiopi
to
NAME=webiopi_custom

Then :
sudo cp webiopi_custom.daemon /etc/init.d/webiopi_custom
sudo update-rc.d webiopi_custom defaults.
sudo update-rc.d webiopi remove

Take not I removed the .daemon extension when copying the startup script
Eric.


On Sun, Jan 27, 2013 at 10:18 AM, Pablo Osuna <pos...@gmail.com> wrote:
Hello. I´m trying to run the webiopi_custom.py as a service at startup. I just can run it as service with  sudo ./webiopi_custom.daemon start but at startup the service do no run again. Adding sudo update-rc.d webiopi defaults just run the default webiopi page. May you tell how to solve this. Thanks in advance. Pablo.

--
 
 

Pablo Osuna

unread,
Jan 27, 2013, 4:22:15 PM1/27/13
to web...@googlegroups.com, Pablo Osuna
Thanks for your answer. This is what I did;

Orginal file:
#! /bin/sh
### BEGIN INIT INFO
# Provides:          webiopi
# Required-Start:    $remote_fs $syslog
# Required-Stop:     $remote_fs $syslog
# Default-Start:     2 3 4 5
# Default-Stop:      0 1 6
# Short-Description: WebIOPi initscript
# Description:       WebIOPi initscript
### END INIT INFO

# Author: trouch <tro...@trouch.com>

PATH=/sbin:/usr/sbin:/bin:/usr/bin
DESC="WebIOPi Custom"
NAME=webiopi-custom
HOME=.
DAEMON=/usr/bin/python
DAEMON_ARGS="webiopi_custom.py"
PIDFILE=/var/run/$NAME.pid
SCRIPTNAME=/etc/init.d/$NAME

New file:

#! /bin/sh
### BEGIN INIT INFO
# Provides:          webiopi_custom
# Required-Start:    $remote_fs $syslog
# Required-Stop:     $remote_fs $syslog
# Default-Start:     2 3 4 5
# Default-Stop:      0 1 6
# Short-Description: WebIOPi initscript
# Description:       WebIOPi initscript
### END INIT INFO

# Author: trouch <tro...@trouch.com>

PATH=/sbin:/usr/sbin:/bin:/usr/bin
DESC="WebIOPi Custom"
NAME=webiopi_custom
HOME=.
DAEMON=/usr/bin/python
DAEMON_ARGS="webiopi_custom.py"
PIDFILE=/var/run/$NAME.pid
SCRIPTNAME=/etc/init.d/$NAME

Then

pi@raspberrypi ~/WebIOPi-0.5.3/examples/custom $ sudo cp webiopi_custom.daemon /etc/init.d/webiopi_custom
pi@raspberrypi ~ $ sudo update-rc.d webiopi_custom defaults
update-rc.d: using dependency based boot sequencing
insserv: script webiopi_custom is not an executable regular file, skipped!
insserv: script webiopi: service webiopi already provided!

Wha could it be wrong?

trouch

unread,
Jan 27, 2013, 4:35:12 PM1/27/13
to web...@googlegroups.com
You have to add execution flag :
sudo chmod a+x /etc/init.d/webiopi_custom

Eric / trouch.


--
 
 

Pablo Osuna

unread,
Jan 27, 2013, 4:56:04 PM1/27/13
to web...@googlegroups.com
pi@raspberrypi /etc/init.d $ sudo chmod a+x /etc/init.d/webiopi_custom
pi@raspberrypi /etc/init.d $ sudo update-rc.d webiopi_custom defaults
update-rc.d: using dependency based boot sequencing
insserv: script webiopi_custom: service webiopi_custom already provided!
insserv: exiting now!
update-rc.d: error: insserv rejected the script header


Thanks Pablo

Pablo Osuna

unread,
Jan 27, 2013, 11:03:23 PM1/27/13
to web...@googlegroups.com
Eric, I really appreciate your help. do you have any ideas. Thanks in advance
Message has been deleted

Pablo Osuna

unread,
Jan 28, 2013, 2:28:51 AM1/28/13
to web...@googlegroups.com
FINALLY SOLVED.

Eric, I am grateful for your support.
 
Step 1
Copy your customized html file to  /usr/share/webiopi/htdocs/index.html
pi@raspberrypi ~/WebIOPi-0.5.3/examples/custom $ sudo cp index.html /usr/share/webiopi/htdocs/index.html

Step 2
Edit webiopi_custom.daemon changing DAEMON ARGS wtih path where your customized py is located
pi@raspberrypi ~/WebIOPi-0.5.3/examples/custom $ sudo nano webiopi_custom.daemon

! /bin/sh
### BEGIN INIT INFO
# Provides:          webiopi
# Required-Start:    $remote_fs $syslog
# Required-Stop:     $remote_fs $syslog
# Default-Start:     2 3 4 5
# Default-Stop:      0 1 6
# Short-Description: WebIOPi initscript
# Description:       WebIOPi initscript
### END INIT INFO

# Author: trouch <tro...@trouch.com>

PATH=/sbin:/usr/sbin:/bin:/usr/bin
DESC="WebIOPi Custom"
NAME=webiopi-custom
HOME=.
DAEMON=/usr/bin/python
DAEMON_ARGS="/home/pi/WebIOPi-0.5.3/examples/custom/webiopi_custom.py"
PIDFILE=/var/run/$NAME.pid
SCRIPTNAME=/etc/init.d/$NAME

Step 3
Copy to /etc/init.d/ and rename as webiopi_custom (without .daemon) 
pi@raspberrypi ~/WebIOPi-0.5.3/examples/custom $ sudo cp webiopi_custom.daemon /etc/init.d/webiopi_custom

Step 4
Add execution flag 
pi@raspberrypi ~ $ sudo chmod a+x /etc/init.d/webiopi_custom

Step 5
Check if it starts as service:
pi@raspberrypi ~ $ sudo /etc/init.d/webiopi_custom start
pi@raspberrypi ~ $ sudo /etc/init.d/webiopi_custom status
[ ok ] webiopi-custom is running.

Step 6 
To verify open a brower to the ip of your Pi
http://raspberrypi:8000/webiopi/

Step 7
Setup your system to starts webiop_custom at startup :
pi@raspberrypi ~ $ sudo update-rc.d webiopi_custom defaults
update-rc.d: using dependency based boot sequencing
insserv: script webiopi: service webiopi already provided!

Step 8

You may restart your Pi, and wait until your customized project starts alone.
pi@raspberrypi ~ $ sudo shutdown -r now

Broadcast message from root@raspberrypi (pts/0) (Mon Jan 28 07:00:29 2013):
The system is going down for reboot NOW!

Step 9
Check it working
pi@raspberrypi ~ $ sudo /etc/init.d/webiopi_custom status
[ ok ] webiopi-custom is running.

Step 10 
Finally open a brower to the ip of your Pi
http://raspberrypi:8000/webiopi/

trouch

unread,
Jan 28, 2013, 4:35:44 AM1/28/13
to web...@googlegroups.com
I'm happy you finally found the solution by yourself !
We certainly missed something at the beginning, I don't have any error on my side.
Thanks for giving steps to follow here.

Eric.


--
You received this message because you are subscribed to the Google Groups "WebIOPi" group.
To unsubscribe from this group, send email to webiopi+u...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.
 
 

Message has been deleted

Pablo Osuna

unread,
Feb 14, 2013, 5:14:07 PM2/14/13
to web...@googlegroups.com
This step were on wheezy-raspbian. But then I installed WebIOPi on Raspbmc and had troubles with final command sudo update-rc.d webiopi_custom defaults. I dont know exactly  the reason but I think on Raspbmc boot services must be "Upstart Jobs". http://upstart.ubuntu.com/cookbook/ What I did is make a file webiopi_config.conf and put it on /etc/init/ to start as upstart job:

Replace Step 7 with following commands:
pi@raspbmc:~$ sudo touch /etc/init/webiopi_custom.conf
pi@raspbmc:~$ sudo nano /etc/init/webiopi_custom.conf copy/paste next

#webiopi_custom as Upstart Job

start on xbmc-started

stop on runlevel [!2345]

respawn

exec sudo /etc/init.d/webiopi_custom start

then control+x --> yes ---> enter
Reply all
Reply to author
Forward
0 new messages