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.

100 questions
319
votes
10 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
  • 249,484
  • 69
  • 436
  • 539
127
votes
12 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
  • 29,306
  • 13
  • 121
  • 110
52
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,581
  • 4
  • 18
  • 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,882
  • 10
  • 58
  • 82
34
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
12
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
  • 5,434
  • 7
  • 36
  • 64
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
  • 497
  • 1
  • 5
  • 14
10
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
  • 133
  • 1
  • 1
  • 8
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
  • 6
  • 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
  • 2
  • 3
  • 14
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
  • 8,459
  • 9
  • 45
  • 70
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,166
  • 27
  • 31
6
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 Bürgmann
  • 6,301
  • 5
  • 43
  • 77
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
  • 711
  • 9
  • 28
1
2 3 4 5 6 7