getting error on Supervison on supervisorctl ERROR (no such process) [closed] - linux

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
I've seen this question asked before, but none of the solutions have worked for me.
I'm having problems using the supervisor on my rpi b+. Every time I try to run my start my process, I get an error saying:
pi#raspberrypi ~ $ sudo supervisorctl start server
server: ERROR (no such process)
I have my config file set up at /etc/supervisord.conf
[program:server]
directory=/home/pi/ledticker
command=/usr/bin/python NetworkServer.py
autostart=false
autorestart=true
stopsignal=QUIT
[supervisord]
logfile=/var/log/supervisor/supervisord.log ; (main log file;default $CWD/supervisord.log)
logfile_maxbytes=50MB ; (max main logfile bytes b4 rotation;default 50MB)
logfile_backups=10 ; (num of main logfile rotation backups;default 10)
loglevel=info ; (log level;default info; others: debug,warn,trace)
pidfile=/tmp/supervisord.pid ; (supervisord pidfile;default supervisord.pid)
nodaemon=false ; (start in foreground if true;default false)
minfds=1024 ; (min. avail startup file descriptors;default 1024)
minprocs=200 ; (min. avail process descriptors;default 200)
[supervisorctl]
serverurl=unix:///tmp/supervisor.sock ; use a unix:// URL for a unix socket
[unix_http_server]
file=/tmp/supervisor.sock ; (the path to the socket file)
I have tried doing the reread, update, reload commands but they haven't worked. Any ideas?

You should try to reload supervisord :
# supervisorctl reload
[y/N] ? y
In many cases, this error is resolved by that reload.

On my Fedora22, I modified below lines in /etc/supervisord.conf:
[include]
files = supervisord.d/*.ini
to
[include]
files = supervisord.d/*.conf
and then reload

i had faced same problem before. It was resolve by following solutions.
First edit your supervisord.conf file and add below lines :
[unix_http_server]
file=/tmp/supervisor.sock
chmod=0777
start SupervisorD service first using following command :
$ sudo /usr/bin/supervisord -c /etc/supervisord.conf
You can verify using : ps -ef | grep python
After supervisord starts, Try to start your program using following command :
$ sudo /usr/bin/supervisorctl -c /etc/supervisord.conf start all

In case of process multi-instances configuration full process name might look like server:server_0 (depends on your process_name template). Try:
sudo supervisorctl restart server:*
Otherwise you'll get same (no such process) error.

In some versions of supervisor the [include] section not work, you need to add the programs in the main supervisor configuration file in /etc/supervisord.conf

Related

Closing an open ssh port in Linux with one line [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
I often ssh tunnel into Rstudio on a server I have set up. I'm trying to devise a single command that I can use to close the ssh port. I know that I can find the PID for localhost:1234 with:
sudo lsof -i :1234
And I also know that I can kill the process with:
sudo kill $(sudo lsof -t -i:1234)
The issue is that if I have Chrome open to run Rstudio server, the 2nd command will kill the open Chrome browswer as well. Is there a way to modify the 2nd command so that I close the open ssh port, but not the Chrome browser? There are two PID numbers, so I could theoretically grep for 'ssh' but I'm not sure how.
EDIT FOR CLARITY:
For example, I get the following output from the first command. I want to modify the 2nd command so that I can kill PID 15834, but not 30117. Apologies, I hope that makes more sense.
try this
sudo kill $(sudo lsof -t -i:1234 -c ssh)
-c => selects the listing of files for processes executing the command that begins with the characters of c.
Just firewall the port:
sudo iptables -I INPUT -p tcp --dport 1234 -j DROP

Bash script check permissions to run command on remote [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 4 years ago.
Improve this question
I have a local development machine and from my bash script am sending commands to the remote server.
How can I write bash code to check if I am allowed to run the remote command so that I can handle the success/failure response from my script?
Alternatively, how can I capture the output so that I can parse it and detect if it succeeded. The difficulty with parsing is that the ssh command might trigger a password prompt so I can't interfere with that.
That bash script uses ssh -qt to send the remote commands
Command
ssh user#host -qt "sudo -u www /usr/local/bin/php /mnt/data/script.php"
Output:
[sudo] password for xxx:
Sorry, user xxx is not allowed to execute '/usr/local/bin/php /mnt/data/script.php' as www on host.domain.com
Assuming that user != root above: you can't - there's no way to read /etc/sudoers or /etc/sudoers.d/* in a normally set-up Linux box if you're not root, so apart from trial & error there's nothing to be done.
As for capturing the result - that's fairly simple (parsing it, of course, is a different story, depending on what you're doing over there).
output=$( ssh user#host -qt "sudo -u www /usr/local/bin/php /mnt/data/script.php" 2>&1 )
After the execution (and you typing the password for sudo)
echo $? # gives you the return-code of what happened on the far end, if it's a success that should be 0
echo $output # gives you the strings to parse

Got an error while executing bash commands on remote ubuntu machine "no tty present and no askpass program specified" [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 7 years ago.
Improve this question
I'm running a bash script to execute a command on a remote host. Here is the command:
ssh ppuser#10.101.5.91 "sudo mv /tmp/$2.tar.gz $1"
$1 and $2 are command line arguments. But while executing I'm getting this error : no tty present and no askpass program specified.
Hope you will help me, any help would be greatly appreciated. Thank You.
Somewhere in your sudoers file you have following
Defaults requiretty
Just comment this line - remove it. Or
Defaults !requiretty
For specific program name you can also attempt following:
Defaults </path to program> requiretty
change it to
Defaults </path to program> ! requiretty
Specific to user you can add
Defaults:username !requiretty
Adding What already have been specified in comment,
For the same you will have to
user-name ALL=(ALL) NOPASSWD: ALL
Its for passwordless sudo
Looks like you are invoking sudo, and it is not working because it doesn't have a tty bound. add
"Defaults visiblepw"
in sudoers file enables sudo even if a console doesn't allocate a tty. Use visudo on the remote machine to add this and see if this helps.
Try this command
sshpasss -p password ssh ppuser#10.101.5.91 "sudo mv /tmp/$2.tar.gz $1"

How to write a program which will be running automatically, whenever I turn on my computer, in Linux? [closed]

Closed. This question is off-topic. It is not currently accepting answers.
Want to improve this question? Update the question so it's on-topic for Stack Overflow.
Closed 9 years ago.
Improve this question
I am creating a process every time but after "kill -9 -1", I lost the process that I created. I know why I lost it every time..
But is there anyway, so that I can make my program run automatically, every time I turn on my computer??
thanks,,
Most distributions still support SysV Init Scripts.
The easiest way to do it is to take a simple init script from /etc/init.d/ and change it to suit your needs:
sudo cp /etc/init.d/foo /etc/init.d/my_foo
sudo gedit /etc/init.d/my_foo
Then, you'll need to enable it:
sudo /sbin/chkconfig my_foo on
If chkconfig isn't available, you may need to install it. Also, there are LSB aliases like insserv which might be available.
Ubuntu systems now come with Upstart, whose configuration files may be a bit less verbose than with System V init scripts. A simple job configuration for Upstart would look like this, and go into, say, /etc/init/example.conf:
# this is a comment
start on startup
stop on shutdown
exec /path/to/program --some-args maybe-another-arg
Then it'll start and stop, well, on startup and on shutdown, respectively. To manually start and stop it, use the start and stop commands as root:
$ sudo start example
$ sudo stop example
You can find more information about Upstart configuration in its Cookbook. Information is also available in the init man page in section 5 on systems where Upstart is installed. (man 5 init)
Supervisor will let you do that, as well as having some other features like FastCGI support, automatically respawning services if they crash (while being smart about it and not restarting it if it keeps crashing over and over again), and keeping logs of its output.
After it is installed and itself configured to run on startup, you can modify its configuration file to add a section that runs a program. A simple example might be like this:
; this is a comment
[program:example]
command = /path/to/program --some-args maybe-another-arg
That's really all that's necessary for a simple program, but many other configuration options are available; see the documentation.
Once you've added your configuration, you can tell Supervisor to add/remove (and start/stop) any processes you've added or removed from the configuration:
$ sudo supervisorctl update
You can manually start and stop services if you want to, as well:
$ sudo supervisorctl start example
$ sudo supervisorctl stop example
$ sudo supervisorctl restart example
You can also see a nifty status display for all of your processes, e.g.:
$ sudo supervisorctl status
cgi-pass RUNNING pid 4223, uptime 68 days, 23:57:22
And also see what it's recorded of your program's output:
$ sudo supervisorctl tail example # stdout
$ sudo supervisorctl tail example stderr # stderr
$ sudo supervisorctl tail -f example # continuous
Documentation of the available commands is available with supervisorctl help.
Fedora comes with systemd, many other Linux distributions are adopting it (except Ubuntu and for now Debian). The package includes several helper programs you'd might want to look at.

Write a bash script to restart a daemon [closed]

Closed. This question is off-topic. It is not currently accepting answers.
Want to improve this question? Update the question so it's on-topic for Stack Overflow.
Closed 10 years ago.
Improve this question
I thought I could just use this related question: How Do I write a bash script to restart a process if it dies. #lhunath had a great answer and told me everything I might do about it was wrong, but I'm restarting a daemon process and if I'm hoping there's something I can do in a single script that works.
my process starts with a kick off script that shows the startup log, but then quits and leaves the process running off the shell:
>sudo ./start
R CMD Rserve --RS-conf /var/FastRWeb/code/rserve.conf --vanilla --no-save
...
Loading required package: FastRWeb
FastRWeb: TRUE
Loading data...
Rserv started in daemon mode.
>
The process is up and running,
ps -ale | grep Rserve
1 S 33 16534 1 0 80 0 - 60022 poll_s ? 00:00:00 Rserve
Is there a simple way to wrap or call the 'start' script from bash and restart when the process dies or is this a case where PID files are actually called for?
Dang - question got closed even after pointing to a very similar question that was not closed on stackoverflow. you guys suck
A very simple way to monitor the program is to use cron: check every minute (or so) if the program still is alive, ./start it otherwise.
As root, invoke crontab -e.
Append a line like this:
* * * * * if ! pidof Rserve 2>&1 >/dev/null; then /full/path/to/start; fi
This method will stay persistent, i.e., it will be executed after a reboot etc. If this is not what you want, move it to a shell script:
#! /bin/bash
# monitor.sh
while true; do
if ! pidof Rserve 2>&1 >/dev/null; then /full/path/to/start; fi
sleep 10
done
This script has to be started manually from the command line, and can be easily stopped with Ctrl-C.
The easiest solution, if you can run the process is NON-daemon mode, is to wrap it in a script.
#!/bin/bash
while (true)
do
xmessage "This is your process. Click OK to kill and respawn"
done
Edit
Many deamons leave a lock file, usually in /var/lock, that contains their PID. This keeps multiple copies of the deamon from running.
Under Linux, it is fairly simple to look throgh /proc and see if that process is still around.
Under other platforms you may need to play games with ps to check for the processes existence.

Resources