I'm working on Raspbian Jessie and I wrote my upstart script by follows this tutorial. Here is my /etc/init/videostream.conf script file.

# RPI Camera Service
description     "RPICAM streaming"
author          "My Name "

start on filesystem or runlevel [2345]
stop on shutdown or runlevel [016]

respawn limit 2 5

env HOME=/etc/default
umask 007
usage "videostream {start|stop|status|restart}"
    export PATH=/opt/local/bin:/opt/local/sbin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
    export HOME="/etc/default"
    echo $$ > /var/run/videostream.pid
    exec /etc/default/videostream >/dev/null 2>&1 &
end script
post-start script
    echo "[`date`] videostream is Started" >> /var/log/videostream.log
end script
pre-start script
    echo "[`date`] videostream Starting" >> /var/log/videostream.log
end script
pre-stop script
    rm /var/run/videostream.pid
    killall -w -q raspivid
    killall -w -q ffmpeg
    echo "[`date`] videostream Stopping" >> /var/log/videostream.log
end script

I install upstart using sudo apt-get install upstart.

When reboot the system, the service start well and work fine. The problem is, After restart until the system is working properly, you can not stop the service or start it.

When ask status you get this:

sudo service videostream status
# Result
videostream stop/waiting

But the service is working because I can see the stream and according to the log file anything seems Ok, unless the fact that the service has start twice on the startup. This is the part of log file.

[Mon Jun 27 08:00:12 UTC 2016] videostream Starting
[Mon Jun 27 08:00:13 UTC 2016] videostream is Started
[Mon Jun 27 08:00:13 UTC 2016] videostream Starting
[Mon Jun 27 08:00:13 UTC 2016] videostream is Started

When I try to start the service, I get this:

sudo service videostream start
# Result
start: Job failed to start

Please can someone help me? I don't really know what is problem.

  • note that debian jessie by default uses systemd now instead of upstart. you might search for problems with them co-existing, or rewrite your script for systemd. – meuh Jun 27 '16 at 16:10
  • Thank very much @meuh I think is a good idea. Another problem I noticed on my RPI, it's became very slow at startup and take more than 5 minutes to start ssh service. I will start working on systemd services. – Erman Jun 27 '16 at 17:35

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.