3

EDIT: Apparently the script DOES run, but it just doesn't start my browser. Still don't know why tho.

I'm trying to use supervisor to run commands/scripts, but I don't seem to be able to get it to work.

I got the idea of the Pi_Video_looper that does the same with the following script :

# Supervisord configuration to run video looper at boot and
# ensure it runs continuously.
[program:video_looper]
command=python -u -m Adafruit_Video_Looper.video_looper
autostart=true
autorestart=unexpected
startsecs=5

So I modified it to my needs to this:

# Supervisord configuration to run video looper at boot and
# ensure it runs continuously.
[program:video_looper]
command=chromium-browser http://google.be --incognito
autostart=true
autorestart=unexpected
startsecs=5

I also used it with the command :

python /home/pi/Startup/Script.py

Which does some testing and then calls the browser, but doesn't do anything either, allthough it runs perfectly from commandline. Am I missing something?

EDIT: Doesn't work after reboot, doesn't work after a sudo service supervisor restart

EDIT 2 : Logfile shows that it should be running, so apparently it just doesn't open it in my GUI?:

2016-01-27 16:40:43,569 INFO daemonizing the supervisord process
2016-01-27 16:40:43,573 INFO supervisord started with pid 4767
2016-01-27 16:40:44,583 INFO spawned: 'video_looper' with pid 4773
2016-01-27 16:40:49,593 INFO success: video_looper entered RUNNING state, process has stayed up for > than 5 seconds (startsecs)
Lonefish
  • 647
  • 2
  • 11
  • 32
  • 1
    Have you checked its not running in the background? – Joe Doherty Jan 28 '16 at 16:03
  • 1
    As stated in my Edits, it is running, chromium is running somewhere. I've also been trying with 'display=:0 chromium-browser' as command, works perfectly, I can fire up chrome on the pi over ssh, but doesn't work when put in Supervisor. It's running, it has a pid, but I have no idea where the actual chromium-window is.. – Lonefish Jan 28 '16 at 16:05
  • 1
    I get that but what does `ps aux | grep chromium` show? This isn't what supervisord is intended for you will need to find a way of viewing the subprocess. `htop` will show you where it is. Chrome shouldn't need starting when closed and on boot a simple script would do the trick. – Joe Doherty Jan 28 '16 at 16:39
  • It does need starting when closed as it's intended to run as a kiosk. As stated before the process was running. But, the main issue was that it was running as root, which apparently is impossible. I was typing the solution on my laptop but had to go, if I put user=pi in the configuration it works as it should :-) – Lonefish Jan 28 '16 at 16:49
  • 1
    Great news. Glad you got it sorted. It may be worth answering your own question in this case :) – Joe Doherty Jan 29 '16 at 09:28

1 Answers1

4

The working version below: The main issue here was that chromium can't be ran as root for some obscure reason

# Supervisord configuration to run chromium at boot and
# ensure it runs continuously.
[program:chromiumbrowser]
command=chromium-browser http://google.be --incognito
user=pi
autostart=true
autorestart=unexpected
startsecs=5
Lonefish
  • 647
  • 2
  • 11
  • 32