Tag Info

Hot answers tagged

12

Have you tried: launchctl list launchctl stop label


10

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 ...


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() ...


6

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 ...


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

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

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 ...


4

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 ...


4

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 ...


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.


4

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 ...


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

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

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 ...


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.


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

Stop the daemon: /etc/rc.d/syslogd stop Append a line to the /etc/rc.conf: syslogd_enable="NO"


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 ...


2

To directly answer your question: no, there is not a cross platform way to start/stop/control daemons. To indirectly answer your question: the typical way this is handled is by baking that kind of functionality into your program and installers (makefiles/build files/msi packages/zips whatever). If I have a daemonized program that I am building (a program ...


2

No. You'll very probably hit the exact same problem with any alternative as you are getting here. Without going into too much detail of what's obvious from the stack trace, which is StackOverflow territory: The problem is almost certainly down to the different process state that a daemon has, compared to a program that you run from a desktop or a shell. ...


2

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" ...


2

A service is bound by regular permission restrictions. It all depends on what user the service runs as. Services are just regular processes that are always running. For example, $ ps aux | grep apache2 root 2845 0.0 0.2 75596 4508 ? Ss Sep06 0:19 /usr/sbin/apache2 -k start www-data 25608 0.0 0.1 74428 2232 ? S Sep09 0:00 ...


2

1) Cygwin has inetd, and you could configure that to launch your code. Once you get the Cygwin base install could also use Cygwin perl/php/python, even bash to be a net daemon. 2) you could run any of these under apache, which is the most common way of running net code for most of these scripts. You'd have to be ok with wrapping your data in HTTP, but it ...


2

If you are trying to daemonize a program that doesn't have a daemon mode then you can use daemonize. There are RPM packages for it in the repoforge repository.


2

You don't mention what OS you are running so I'm going to assume it is a Windows variant from 2000 or later. All recent Windows variants have a task scheduler and the "windows scripting host" through which you can run scripts written in vbscript or jscript, so a simple way to do what you are looking for without installing extra software is: create a text ...



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