I am trying to start my python web.py server at boot, but I am having difficulties getting it running by itself.
I have a config-file like the following. It's basically the sample file with an added program. The file lives in /etc/supervisor/conf.d/
and is called supervisord.conf
[unix_http_server]
file=/tmp/supervisor.sock
[supervisord]
logfile=/tmp/supervisord.log
logfile_maxbytes=50MB
logfile_backups=10
loglevel=info
pidfile=/tmp/supervisord.pid
nodaemon=false
minfds=1024
minprocs=200
[rpcinterface:supervisor]
supervisor.rpcinterface_factory = supervisor.rpcinterface:make_main_rpcinterface
[supervisorctl]
serverurl=unix:///tmp/supervisor.sock
[program:server]
directory = /home/pi/Server/
command = python server.py
autostart = true
autorestart = true
user = pi
environment=HOME="/home/pi", USER="pi"
stdout_logfile = server-stdout.log
stdout_logfile_maxbytes = 10MB
stdout_logfile_backups = 5
stderr_logfile = server-stderr.log
stderr_logfile_maxbytes = 10MB
stderr_logfile_backups = 5
Now when I am rebooting my raspberry and open up supervisorctl
I see the error: error: <class 'socket.error'>, [Errno 111] Connection refused: file: /usr/lib/python2.7/socket.py line: 571
I managed to get it running if I cd
into ~/Server
where my server.py
file is located and also copy the supervisord.conf
there, then sudo service supervisor restart
and sudo supervisord -c supervisord.conf
.
Now my server is running like it should...
But I need my server to automatically at boot. I guess it's a problem with being root user vs. not or something like that...