Questions tagged [start-stop-daemon]

`start-stop-daemon` is a program used to control the creation and termination of Linux system-level processes (daemons).

start-stop-daemon is a program used to control the creation and termination of Linux system-level processes (daemons). Using one of the matching options, start-stop-daemoncan be configured to find existing instances of a running process.

The man page specifies below note:

Note: unless --pidfile is specified, start-stop-daemon behaves similar to killall(1). start-stop-daemon will scan the process table looking for any processes which match the process name, uid, and/or gid (if specified). Any matching process will prevent --start from starting the daemon. All matching processes will be sent the TERM signal (or the one specified via --signal or --retry) if --stop is specified. For daemons which have long-lived children which need to live through a --stop, you must specify a pidfile.

Usage sample:

start-stop-daemon --start --background -m --pidfile ${PIDFILE} --exec ${DAEMON} -- ${TARGETDIR}

Command arguments explanation:

  • --start : Check for an instance of the specified process and start it (if not already started).
  • --background : the daemon is launched as a background process.
  • -m : make a PID file. This is used when your process doesn't create its own PID file, and is used with --background.
  • --pidfile ${PIDFILE} : check if the PID file has been created or not.
  • --exec : make sure the processes are instances of this executable (in this case, DAEMON)

For more informations and more options, check the man page.

98 questions
242
votes
8 answers

How to process SIGTERM signal gracefully?

Let's assume we have such a trivial daemon written in python: def mainloop(): while True: # 1. do # 2. some # 3. important # 4. job # 5. sleep mainloop() and we daemonize it using start-stop-daemon which…
zerkms
  • 230,357
  • 57
  • 408
  • 498
122
votes
11 answers

How can I log the stdout of a process started by start-stop-daemon?

I am using an init script to run a simple process, which is started with: start-stop-daemon --start --quiet --chuid $DAEMONUSER \ --make-pidfile --pidfile $PIDFILE --background \ --exec $DAEMON $DAEMON_ARGS The process called…
joeytwiddle
  • 24,338
  • 11
  • 107
  • 91
47
votes
2 answers

What is start-stop-daemon in linux scripting?

What is start-stop-daemon and how should it be used? I am trying to automate a particular program to run. Whenever the system starts, the program should run. For that I am writing script in /etc/init.d/ location.
Rajeev Das
  • 1,503
  • 4
  • 17
  • 21
36
votes
12 answers

Start JBoss 7 as a service on Linux

Previous versions of JBoss included a scripts (like jboss_init_redhat.sh) that could be copied to /etc/init.d in order to add it as a service - so it would start on boot up. I can't seem to find any similar scripts in JBoss 7. Has anyone already…
Andrey
  • 8,010
  • 8
  • 51
  • 80
33
votes
2 answers

how can I run rails server daemon?

I am new at rails world and need to run my rails test server in daemon mode.. I've noticed that there is a a -d flag but its not working for me.. rails -s -d shouldn't it be like this?
user1619828
10
votes
2 answers

start-stop-daemon and python

I'm trying to start python script with start-stop-daemon: sudo /sbin/start-stop-daemon --start --pidfile /home/loop.pid \ --user www-data --group www-data -b --make-pidfile --chuid www-data \ --exec /usr/bin/python /home/loop.py --verbose but no…
evg
  • 467
  • 1
  • 5
  • 13
10
votes
2 answers

How to gracefuly shutdown a Spring Boot application by start-stop-daemon

We have a multithreaded Spring Boot Application, which runs on Linux machine as a daemon. When I try to stop the application by start-stop-daemon like this start-stop-daemon --stop --quiet --retry=TERM/30/KILL/5 --pidfile $PIDFILE --name $NAME The…
Michal Krasny
  • 4,383
  • 6
  • 27
  • 51
9
votes
1 answer

"start-stop-daemon: unable to stat"

i have the following start-stop-script: NAME="examplestartstop" PATH="/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin:/opt/node/bin" LOGFILE="/var/log/$NAME/start-stop-daemon.log" APP_DIR="/usr/bin" APP_BIN="tail -250f…
Florence V. Lee
  • 123
  • 1
  • 1
  • 7
8
votes
2 answers

start-stop-daemon and java program

I'm having a heck of a time getting a java program to launch properly in an init script using start-stop-daemon. I've written the init script and it seems to run but there's never a process afterward representing the running program. Here's a…
ColonelPackage
  • 501
  • 1
  • 5
  • 14
8
votes
1 answer

Run python flask on EC2 in the background

I have small app created on python flask and deployed on EC2 aws machine, when I do ssh to ec2 machine and starts flask, it works, but when I terminate the session the flask dies, I can run it using nohup. What is the best way to make it independent…
meraj
  • 195
  • 1
  • 2
  • 13
7
votes
2 answers

How to process SIGTERM signal gracefully in Java?

Let's assume we have such a trivial daemon written in java: public class Hellow { /** * @param args the command line arguments */ public static void main(String[] args) { while(true) { // 1. do // 2.…
7
votes
2 answers

start-stop-daemon error (Exec format error)

This command is part of an upstart script, which used to work in ubuntu 12.04, 10.04. sudo start-stop-daemon --start --make-pidfile --pidfile /var/run/mk_order_handler.pid --chuid ubuntu --exec /data2/src/jeapps/sites/crons_index.php…
robert
  • 7,691
  • 9
  • 41
  • 68
6
votes
1 answer

Issues with celery daemon

We're having issues with our celery daemon being very flaky. We use a fabric deployment script to restart the daemon whenever we push changes, but for some reason this is causing massive issues. Whenever the deployment script is run the celery…
John
  • 5,057
  • 25
  • 31
6
votes
1 answer

start-stop-daemon does not write to nginx.pid file even though the file is present

This may seem to be a repeated question but it is not. I found some articles on it where start-stop-daemon doesn't create a PID file. But in my case, I have already created the PID file. I execute this command on my server to start…
Narendra Rajput
  • 693
  • 8
  • 27
5
votes
1 answer

Debian start-stop-daemon. Java start jar File

I have this command in a shellscript in /etc/init.d/ start-stop-daemon --start --quiet --make-pidfile --pidfile /var/run/$NAME.pid --background --exec /usr/bin/java -jar /home/username/myjar.jar If i execute this i get this…
Yannic Klem
  • 5,519
  • 2
  • 35
  • 72
1
2 3 4 5 6 7