Hot answers tagged

16

Buildroot has three possible init systems, so there are three ways to do this: BusyBox init With this, one adds an entry to /etc/inittab. ::respawn:/bin/myprocess Note that BusyBox init has an idiosyncratic /etc/inittab format. The second field is meaningless, and the first field is not an ID but a device basename. Linux "System V" init Again, one ...


14

The monit answer above is valid, but I thought I'd mention some alternatives: Supervisor daemontools daemontools-encore runit Upstart systemd sysvinit s6 perp nosh It's worth bearing in mind that your operating system has already solved the process management problem. Traditionally, Linux has used sysvinit, which is basically the collection of scripts ...


12

Have you tried: launchctl list launchctl stop label


10

What about creating a subshell with a loop that calls constantly the same process? If it ends, the next iteration of the loop goes on and starts it again. (while true; do /bin/myprocess done) & If the subshell dies, it's over though. The only possibility in that case would be to create another process (I'll call it necromancer) that checks ...


9

You don't need anything special to make a daemon, really. Any program in any language can "daemonize" itself. Alternatively, you can daemonize an existing program with a small shell script wrapper (for instance the /etc/init.d program launcher can take care of it). Typically, a daemon has the following properties : working directory must be / STDIN must ...


9

Square brackets are used for processes that do not have an associated command line (mostly kernel threads and some system services). If I recall correctly, you might be able to achieve the same effect for your process by setting argv[0] to the empty string.


8

In most linux distributions you can manually start/stop services by (as root or using sudo) running the following commands: # /etc/init.d/apache2 start # /etc/init.d/mysqld start # /etc/init.d/apache2 stop # /etc/init.d/mysqld stop Which services that are automatically started is controlled by file links in /etc/rc[runlevel].d/ . Find your current ...


8

Two things: You should always check return values from system and library functions. If you had if(remove(dirp->d_name)<0) perror(dirp->d_name); else files_deleted++; then you'd see what was happening. The reason your code doesn't work is because remove() and unlink() require the full path to the file in question, whereas readdir() ...


7

The easiest way would be to add it to /etc/inittab, which is designed to do this sort of thing: respawn If the process does not exist, start the process. Do not wait for its termination (continue scanning the /etc/inittab file). Restart the process when it dies. If the process exists, do nothing and continue scanning the /etc/inittab file. For ...


7

iptables is a poor example as it's not really a service or daemon that is running, but part of the kernel. You can't really "stop" iptables, you can only give it a configuration and "stopping" it involves giving it a blank configuration. Indeed I have had Linux systems crash, but the port forwarding setup using iptables continues to work. Anyway, a ...


6

Ubuntu 10.04 is in the middle of a transition between two service management systems: SysVinit (the traditional system, used by most Linux distributions) and Upstart (a newer system pushed by Ubuntu and becoming available in more and more distributions). SysVinit service management scripts are in /etc/init.d. You can start the service with ...


5

For pure daemon usage on a headless server, rtorrent would be the client I would go to. It's command-line and very feature complete, although it's not the easiest thing to set up being purely command line. There are numerous web interfaces to rtorrent as well, although, again, they don't seem to be very easy to set up. For GUI clients, I prefer ...


5

I had the same problem using CentOS 6 with supervisor 2. I will assume you run a similar configuration. In my case, upgrading solved the problem. However, there are no available up to date supervisord binary package for my system. So here is how I have updated: First, download the following source RPM supervisor-3.0-0.5.a10.fc16.src.rpm (available here: ...


5

As you mention having access to an outside server, you should be able to do this via reverse tunnel. From your home system, you'll want to ssh to the remote server, with syntax like: ssh -g -R 12345:localhost:22 user@remoteserver the -g flag allows remote hosts to connect to the forwarded port. Otherwise, the default ssh setting is that only the system ...


5

Docker is the name of the open platform for developers and sysadmins to build, ship, and run distributed applications. Docker.io on the other hand is the name of the package that you install in your Linux OS (i.e. Ubuntu). See this link here. In terms of how it works, the Docker Engine consists of two parts: a daemon, a server process that manages all the ...


4

I figured this out thanks to playing with Riak from Basho. The directions for Yosemite are: To adjust open files limits on a system-wide basis in Mac OS X Yosemite, you must create two configuration files. The first is a property list (aka plist) file in /Library/LaunchDaemons/limit.maxfiles.plist that contains the following XML configuration: ...


4

After you put plist in /Library/LaunchDaemons you need to run command sudo launchctl load -w /Library/LaunchDaemons/your.plist See man launchctl for the -w flag (it does exactly what you need) Edit: did you set the RunAtLoad key to true in your plist? Edit2: I forgot, RunAtLoad has no influence on autolaunch, it is all bout Disabled key.


3

Launchd doesn't just launch programs, it monitors them as they run. By default, it expects the programs to keep running (as daemons), not to start some other program (/background copy of themselves/whatever) and exit. If the program does exit, launchd does two things that can cause problems for a run-and-exit program like youtrack start: it'll "clean up" ...


3

It turns out the fact that it was running as a user called "deluge" is significant. The guide had me set deluge's home directory to /var/lib/deluge, where there was a second configuration directory - the one which was actually read by the daemon. When I used the password for localclient from that auth, instead of the previous <a long string>, I was ...


3

You wanna use Deluge. It's awesome. From the About Deluge page: Core/UI split allowing Deluge to run as a daemon Connect remotely to the Deluge daemon Web UI Console UI GTK+ UI BitTorrent Protocol Encryption Mainline DHT Local Peer Discovery (aka LSD) FAST protocol extension µTorrent Peer Exchange UPnP and NAT-PMP Proxy support Web seed Private Torrents ...


3

Allmost all GNU/Linux torrents have daemons these days. I personally use Transmission, but you can also use Deluge, uTorrent and many others.


3

Running pulseaudio -v in a terminal (run pulseaudio -k first if it complains about already being started, but since you say it doesn't work, it most probably is not running. Prefix sudo if it complains about permissions) should get you more detailed output on why PulseAudio won't start, which will enable you to find more specific info in your case. If ...


3

Since a daemon is a program that is a background process (that is, a process that doesn't involve any interaction on your part in doing what it does), and persists until the process is killed (lets say via an init script you wrote for this very thing), then yes. If you daemonize uWGSI, it will run until you kill the process spawned by the daemon. You might ...


3

To start a script in non-interacting session, use nohup (it will detach your process in a standalone term). To make your script executable, use chmod ugoa+x <script_name>. The last point, do not use #!/bin/bash or #!/bin/sh because you don't know if resides in /bin; try using #!/usr/bin/env bash (or sh) which forces the process to work under bash ...


3

Use the netstat tool. For example: netstat -pan Look under the section that says "LISTEN" and it will tell you what ports the daemons are listening on. Note that you should run this as root unless the daemon is running as the user you're logged in as.


3

It seems docker is just a symbolic link to docker.io: > file $(which docker) /usr/local/bin/docker: symbolic link to `/usr/bin/docker.io' So we can assume that docker.io is both the daemon and the client process, just invoked with different flags I assume?!


2

Normally, no. When re-installing MySQL the existing databases are usually not removed. That's why you may see notes to drop the databases before you uninstall, if you go that way. However, if you're still unsure, create a backup copy of the contents of the data folder, which will contain all your databases. You'll see a lot of .frm files inside. Then after ...


2

Given your description of the problem I suspect something other than you describe is happening. In any case, try this: # sda2 mount /dev/sda2 /mnt/tmp tar -C /mnt/tmp -cf ~/Desktop/sda2.tar . umount /dev/sda2 # ... repeat for sda3 ... # do your create partition shenanigans mount /dev/newsda2 /mnt/tmp tar -C /mnt/tmp -xpf ~/Desktop/sda2.tar umount ...


2

We are using this simple script to make an alert and start the service if it is not running, You can add more services too.. file name: uptime.sh #!/bin/bash #service monitoring /bin/netstat -tulpn | awk '{print $4}' | awk -F: '{print $4}' | grep ^80$ > /dev/null 2>/dev/null a=$(echo $?) if test $a -ne 0 then echo "http service down" | mail ...



Only top voted, non community-wiki answers of a minimum length are eligible