Add new service to existing supervisord process - supervisord

Say I already have a supervisord process running on my machine. How can I add a new service/process for supervisord to monitor? For example, assume I have this simple .conf file:
run-suman-daemon.conf
[program:suman-daemon]
command=/Users/alexamil/WebstormProjects/suman/cli/suman-daemon.sh
I tried:
supervisord add run-suman-daemon.conf
but I get this error:
Error: positional arguments are not supported: ['add', 'sup.conf']
For help, use /usr/local/bin/supervisord -h
The supervisord daemon is running and I can connect to it with supervisorctl

You can use following commands for reading the new configuration and starting the new processes
supervisorctl reread
supervisorctl update

If you want to add a process dynamically, add this section to your supervisord.conf:
[include]
files = dir-with-your-conf-files/*.conf
All conf files placed in dir-with-your-conf-files will be loaded by the main config files. So you put, remove, change files in that dir (for example create symbolic links) and then run:
# reread configuration
supervisorctl reread
# start/stop new/old processes
supervisorctl update

I think you should call supervisorctl update first.

Related

Error: Unable to load celery application. The module main was not found. Supervisor + celery

I can’t start a bunch supervisor and celery. Because celery does not see my module app.
/etc/supervisor/conf.d/celery.conf
[program:celery]
command=/home/ubuntu/django/.env/bin/celery -A main worker --app=main --loglevel=info
user=root
stdout_logfile=/home/ubuntu/django/deployment/logs/celery.log
stderr_logfile=/home/ubuntu/django/deployment/logs/celery_main.log
autostart=true
autorestart=true
startsecs=10
stopwaitsecs = 600
-django
--.env
--main
---settings.py
---celery.py
...
--orders
--shop
if I run this command in a virtual environment in my project directory everything works fine. But if I want to do it at a distance I can not, Why? In my logs celery says Error: Unable to load celery application. The module main was not found.
What I don't see in your configuration file is the working directory, that could explain why the celery command can not find the module, but it is working when you run it manually.
Try adding:
directory=/home/ubuntu/django
to your configuration file and see if this will fix the error.

how to run mongod as daemon with replica configurations?

I use to run the mongodb service with the command ( in CentOS)
sudo mongod --config /etc/mongod.conf
in mongod.conf file replica set information are there.
Now when my system is rebooted, I want automatically this service to run.
How can I do this ?
The /etc/rc.d/rc.local script is executed by the init command at boot time or when changing runlevels. Any command that you want to run after reboot can be added in this file. Just add the command at the end of the file /etc/rc.d/rc.local
You should also check the section Using a Basic Init Script in the following link: https://www.linode.com/docs/databases/mongodb/use-mongodb-to-store-application-data-on-centos-5/

Supervisor socket error issue [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
This question does not appear to be about a specific programming problem, a software algorithm, or software tools primarily used by programmers. If you believe the question would be on-topic on another Stack Exchange site, you can leave a comment to explain where the question may be able to be answered.
Closed 3 years ago.
Improve this question
$ supervisorctl reread
error: <class 'socket.error'>, [Errno 111] Connection refused: file: /usr/lib64/python2.6/socket.py line: 567
I'm trying to configure supervisor on my production system, but am hitting this error. The supervisor log file is empty.
When I just type supervisorctl, it complains:
http://localhost:9001 refused connection
Nothing is currently listening on port 9001, AFACT: lsof | grep TCP returns nothing.
You have to start supervisord before you can use supervisorctl. In my case:
sudo supervisord -c /etc/supervisor/supervisord.conf
sudo supervisorctl -c /etc/supervisor/supervisord.conf
If you started supervisord with a custom path, like this:
sudo supervisord -c /mypath/supervisord.conf
Then you should also start supervisorctl with the same parameter, like this:
sudo supervisorctl -c /mypath/supervisord.conf
You can get this issue if you start supervisor with a relative url for -c and then try run supervisorctl from a different directory.
For example:
supervisord -c supervisord.conf
supervisorctl start someapp ## works
cd somedirectory
supervisorctl restart someapp ## http://localhost:9001 refused connection
Solution would be to always use the absolute path. e.g.:
Good:
supervisord -c /etc/supervisor/supervisord.conf
Bad:
supervisord -c supervisord.conf
This issue also occurs when an old vesion of supervisord.conf file is used.
Newer version of supervisor uses different configuration file.
The above solutions don't work.
In this case you just have to regenerate the configuration file with
echo_supervisord_conf > /etc/supervisord.conf
Hope it helps someoone.
please do the following :
sudo service supervisor start
post which everything is normal as b4 - there is a problem with 1b version
sudo supervisorctl reload
In Ubuntu 18.04 with distribution's package
You probably did the same mistake as me an created the config file /etc/supervisord.conf while my service manager (systemd) was using the config file /etc/supervisor/supervisord.conf
sudo rm /etc/supervisord.conf
Or
sudo mv /etc/supervisord.conf /etc/supervisor/supervisord.conf
if you want to keep it
Now you can run sudo supervisorctl
Why?
when you run supervisorctl it first searches for the config file located at /etc/supervisord.conf, if it's not present, it will search for the package's default file /etc/supervisor/supervisord.conf this is the one systemd actually runs.
Systemd always use the file /etc/supervisor/supervisord.conf regardless of the other file's existence.
You can check which file is using systemd by running sudo systemctl status supervisor
You can see in the last line the command where the config file is hardcoded
both supervisord and supervisorctl use -c with absolute config file path, make sure both commands startup with same config.

create service using searchd command of Sphinx

I make index on one Sphinx compatible xml document.It runs success fully.
Then i make service using searchd command.Following is command to make service
searchd --install --config "path for config file" --servicename "servicename" --port "portnumber".
If Sphinx config file is put inside Sphinx directory then service create and start successfully.
But if config file is not inside Sphinx directory then service created successfully but it can not start successfully.
Should i change something inside searchd block in config file?
According the the documentation (http://sphinxsearch.com/docs/current.html#ref-searchd) all parameters specified when creating the service is called when starting the service.
--install installs searchd as a service into the Microsoft Management Console (Control Panel / Administrative Tools / Services). Any other parameters specified on the command line, where --install is specified will also become part of the command line on future starts of the service. For example, as part of calling searchd, you will likely also need to specify the configuration file with --config, and you would do that as well as specifying --install. Once called, the usual start/stop facilities will become available via the management console, so any methods you could use for starting, stopping and restarting services would also apply to searchd. Example:
C:\WINDOWS\system32> C:\Sphinx\bin\searchd.exe --install --config C:\Sphinx\sphinx.conf
The above command means that the config file must always exist at C:\Sphinx\sphinx.conf.
If your "path for config file" exists and the service still does not start, then I would suggest creating a bug at http://sphinxsearch.com/bugs/main_page.php so it cab be resolved.
In the meantime, put the config file in the Sphinx directory where it works.
Make sure you have a log folder in the sphinx folder. If you check the searchd section of the config file, it will have an option for where the log files and pid are to be placed. If the directory does not exist, then the service will not start.

Zookeeper: FAILED TO WRITE PID

So I'm trying to to get started with Accumulo. I installed Hadoop and it runs w/o problems but when I try to start Zookeeper I get:
JMX enabled by default
Using config: /opt/zookeeper/bin/../conf/zoo.cfg
-n Starting zookeeper ...
/opt/zookeeper/bin/zkServer.sh: line 103: /tmp/zookeeper/zookeeper_server.pid: No such file or directory
FAILED TO WRITE PID
I've looked around can't seem to find an answer.
I have had the same problem. In my case was useful to start Zookeeper and directly specify a configuration file:
/bin/zkServer.sh start conf/zoo.conf
I have never heard of zookeeper, but it could be a permissions issue trying to write the file zookeeper_server.pid or perhaps the directory /tmp/zookeeper/ doesn't exist and the shell script isn't accounting for that possibility. Check the permissions and existence of those directories.
zookeeper distributed with default conf, uses /tmp/zookeeper as dataDir for just example sake. It is suggested changing this value in /path/to/zookeeper/conf/zoo.cfg to /var/lib/zookeeper.
Creating /var/lib/zookeeper needs root access, so sudo is required. This directory when created will have following permissions.
ls -al /var/lib/zookeeper/
drwxr-xrwx 4 root wheel 128 May 9 14:03 .
When zookeeper is started without root permission, it cannot write to this directory. hence fails with error
... /usr/local/zookeeper/bin/zkServer.sh: line 169: /var/lib/zookeeper/zookeeper_server.pid: Permission denied
FAILED TO WRITE PID
You need to give write permissions to allow user starting zookeeper to write to /var/lib/zookeeper. In my case, as I am using it in local, I used the following command and it worked
sudo chmod o+w /var/lib/zookeeper