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
2
votes
1 answer

custom linux daemon won't stop using "service stop"

I've written a custom python daemon that runs as a service via an init.d script on ubuntu 14.04. Starting the service works fine, but when I try to do "service monitor stop", the daemon is not terminated. I'm using pyinotify to daemonize a file…
R. W.
  • 267
  • 1
  • 4
  • 9
2
votes
1 answer

start-stop-daemon: pass arguments to application (vertx)

I'm trying to build an upstart configuration that's used in combination with monit. I'd like to pass some arguments to vertx as well (multiple instances of the verticle), but I'm failing to get a proper statement on the shell already, so I think…
DoNuT
  • 404
  • 1
  • 4
  • 20
2
votes
1 answer

LD_PRELOAD which program is target

Is there a way to figure out which program is the one being targeted by a LD_PRELOAD? LD_PRELOAD=/path/to/libstuff.so ./stuff Like when building the libstuff library in C/C++ and when it's preloaded is there a way to figure out that the…
vlieger
  • 25
  • 3
2
votes
2 answers

can't run Daemon::Control perl script as root. @INC not correct (perlbrew)

I've written a Daemon::Control script in perl, which I can start/stop as a service from the user, but now I want to have this run on reboot. When I run as a user all is well, when I run it as root, it fails with Can't locate Mojo/Server/Morbo.pm in…
2
votes
1 answer

Launching command using NSTask returns error

I'd like to launch the following command from my application using NSTask: sudo -u myusername launchctl load /Library/LaunchAgents/com.google.keystone.agent.plist Here is a code I do: NSPipe *pipe = [NSPipe pipe]; NSTask *task = [[NSTask…
Serhii
  • 1,742
  • 2
  • 25
  • 54
2
votes
1 answer

daemon refusing to execute unsafe program

I want to start a service after my system start, here's my script in /etc/rc.local : daemon /usr/bin/python /usr/local/google/home/yowang/Downloads/ftp.py > /var/log/pyftpd.log 2>&1 Error output at /var/log/pyftpd.log looks like this: daemon:…
WoooHaaaa
  • 17,162
  • 29
  • 79
  • 130
2
votes
1 answer

How to get a python daemon to perform an action on stop

Using code I found here to implement a simple daemon, I'm wondering if there is any way for me to get the daemon to perform an action just before being stopped. The idea is that in my script, I'm using a serial connection to an external device, and…
gromain
  • 202
  • 3
  • 10
1
vote
1 answer

Linux Daemon Stopping start-stop-daemon

I have a daemon I am creating in linux. I created the init.d file and have successfully started the daemon process using /etc/init.d/mydaemon start When I try to stop it(with /etc/init.d/mydaemon stop), however, it stops successfully, but…
user623879
  • 3,842
  • 8
  • 32
  • 52
1
vote
4 answers

Why didn't my init.d start-stop-daemon script start the application on boot, but I can start the service manually?

I thought I finally had managed to write my first init.d script properly but when I went to reboot, the launch didn't happen. The script start-foo looks like this: #! /bin/sh # chkconfig 345 85 60 # description: startup script for foo # processname:…
Kit Sunde
  • 32,665
  • 22
  • 111
  • 176
1
vote
2 answers

Gracefully shutdown a generic host in .NET Core 2 linux daemon

I'm completely new with both .NET Core and developing linux daemons. I've been through a couple of similar questions like Killing gracefully a .NET Core daemon running on Linux or Graceful shutdown with Generic Host in .NET Core 2.1 but they didn't…
Diego
  • 15,566
  • 24
  • 79
  • 132
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
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
  • 7,597
  • 16
  • 79
  • 124
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
  • 326
  • 2
  • 12
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
  • 726
  • 3
  • 14
  • 36
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
  • 4,843
  • 4
  • 38
  • 68