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
1
vote
1 answer

how to create a PID file for a java process

I'm attempting to create a PID file like below: LOCKFILE=/var/lock/ocr-trafficcop.lock PIDFILE=/var/run/ocr-trafficcop.pid JVM_ARGS="-Xms1024M -Xmx2048m -Dspring.config.location=/opt/app/configs/ocr-trafficcop/ -DserviceName=ocr-trafficcop…
Simply Seth
  • 3,246
  • 17
  • 51
  • 77
1
vote
0 answers

Forked init.d process becomes unresponsive

I have a script to start and fork a netcat process. After a while, the netcat process stops logging output. Remote computers are supposed to connect to the socket and send a message every few hours, but it seems like the netcat process dies/halts…
Connor
  • 11
  • 2
1
vote
2 answers

LaunchDaemons is giving error 127

i have a problem when i run LaunchDaemons this is my .plist:
cickStar
  • 119
  • 1
  • 2
  • 8
1
vote
1 answer

How can I get start-stop-daemon to write the child process ID to the pid file?

I'm writing an init.d script to start a program that I've written in C. The program follows a pretty standard template where it calls fork() to create a child process, and then the parent process terminates almost immediately. The trouble I'm…
soapergem
  • 9,263
  • 18
  • 96
  • 152
1
vote
2 answers

How to properly start/stop CouchDB 2.0 on Ubuntu

I have installed CouchDB 2.0 on Ubuntu 16.04, and can run it fine by launching ~couchdb/bin/couchdb. Now I would like to make it start and stop properly on system boot/shutdown. The doc states that daemonization scripts are no longer provided in…
bfredo123
  • 462
  • 1
  • 8
  • 20
1
vote
1 answer

sbin/start-stop-daemon not able to start python - ubuntu docker container

I have a simple python script which I want to start a daemon-service in background in docker container /sbin/start-stop-daemon --start --user root --make-pidfile --pidfile /var/lock/subsys/my-application.pid --exec 'python…
Dave
  • 962
  • 5
  • 19
  • 44
1
vote
1 answer

Catalyst exiting when started with start-stop-daemon

I am trying to run Catalyst on CentOS 7 using start-stop-daemon. Here is the start-stop-daemon command that I run: start-stop-daemon --start --pidfile /var/run/myapp.pid -d "/home/user/myapp" --exec /opt/perlbrew/perls/perl-5.22.0/bin/perl --startas…
srchulo
  • 5,143
  • 4
  • 43
  • 72
1
vote
0 answers

Configuring Motion to run as daemon in Raspberry and right (?) issues

I'm able to tun my motion detection in my Raspberry 2: In /etc/default/motion I changed start_motion_daemon=no to start_motion_daemon=yes Next I enabled motion by entering the following at the command line: sudo systemctl enable motion Finally…
hannes ach
  • 16,247
  • 7
  • 61
  • 84
1
vote
1 answer

What is the proper way to terminate a script using start-stop-daemon?

I am using a start-stop-daemon to make a INIT script for my script. I am using --make-pidfile cause my script doesn't make its own pid. I can start my script using start and pid file generates with appropriate PID. But the stop function doesn't…
Kamrul Khan
  • 3,260
  • 4
  • 32
  • 59
1
vote
1 answer

Changing process name when running Python as daemon

I found this excellent website which gives an example upstart script for running Python scripts as daemons. My question is, can I change the name it reports as when I type ps -e? I was thinking start-stop-daemon might have an option to do that but I…
1
vote
0 answers

Python script as service in init.d, is it worth to daemonize?

I have few python scripts that I want to have as a service in a system. My initial approach was to use python-daemon and it worked. Process was detached and running in the background. Then I have learnt that init.d provides wrapper to what I need,…
Drachenfels
  • 3,037
  • 2
  • 32
  • 47
1
vote
1 answer

Stop Daemon not terminating child java process

following setup Start-Stop-Daemon: do_start start-stop-daemon -S -m -p $PIDFILE --name myapp --exec /opt/myapp do_stop start-stop-daemon -K -R TERM/30/KILL/5 -p $PIDFILE --name myapp the script I start looks like that: java -jar ./myapp.jar so…
Tobi
  • 924
  • 1
  • 10
  • 39
1
vote
2 answers

Solr upstart script using start-stop-daemon

I want to start my solr using upstart command. The command I use to start solar normally is /usr/bin/java \ -Dsolr.solr.home=/home/justeat/work/projects/solr/apache-solr-4.0.0/example/solr \ -Djetty.port=8983…
robert
  • 8,459
  • 9
  • 45
  • 70
1
vote
4 answers

Restarting a linux daemon

I have Linux daemon that I have written in C++ that should restart itself when given a "restart"-command from a user over the network through its console. Is this possible? I use a /etc/init.d script. How can I program it to restart itself? Should I…
user152949
1
vote
1 answer

Upstart script for New Relic monitoring plugin

I am trying to start a New Relic monitoring plugin MeetMe/newrelic_plugin_agent with upstart on Ubuntu 12.04. Here is the script I wrote: env USER=newrelic env DAEMON="/usr/local/bin/newrelic_plugin_agent" env DAEMONARGS=" -c…
silentser
  • 2,083
  • 2
  • 23
  • 29