Open crised opened 10 years ago
About daemonize: http://www.freedesktop.org/software/systemd/man/daemon.html Have a look at "new style daemons" section. Basically, if we use systemd to handle our program (start it at boot, restart it if it fails, etc) then we shouldn't put all that "daemonize" code.
See this: http://superuser.com/a/125650/145491
@rnicolau Don't add code to the program, just make a simple scrip to put it inside /etc/init.d, so it starts at boot, and we can start/stop it.
See this example: https://gist.github.com/crised/6684173
Even simpler service script in /etc/init.d:
description "iperf - TCP" author "blah"
start on runlevel [35] stop on runlevel [!35]
exec /usr/bin/iperf -s respawn
Yes, that simple service file is what I'm talking about, that's an Upstart script. Having your program started/stopped/restated by Upstart is what I recommended.
Cool
On Tue, Sep 24, 2013 at 11:07 AM, rnicolau notifications@github.com wrote:
Yes, that simple service file is what I'm talking about, that's an Upstart script. Having your program started/stopped/restated by Upstart is what I recommended.
— Reply to this email directly or view it on GitHubhttps://github.com/crised/electrical/issues/19#issuecomment-25006674 .
All done. Please read the readme about how to install the service. Also database tables need to be created again for the correct type of integers and indexing key, copy and paste from readme. Important: service will run as root, so new database user must be created.
Radu good, thanks. But the db must be run by a user, not root as well as this daemon. Keep up the good work On Sep 24, 2013 8:43 PM, "rnicolau" notifications@github.com wrote:
All done. Please read the readme about how to install the service. Also database tables need to be created again for the correct type of integers and indexing key, copy and paste from readme. Important: service will run as root, so new database user must be created.
— Reply to this email directly or view it on GitHubhttps://github.com/crised/electrical/issues/19#issuecomment-25051716 .
ok, done. You need to edit the service file to specify the correct user.
Please finish C daemon: