Commit graph

25 commits

Author SHA1 Message Date
Laurence Withers
c55693ce1c Add respawn checking feature
Add a feature which allows arbitrary checks to be performed whenever the child
process is about to be respawned. Currently implemented checks allow running of
a command (via system(3)) or testing the existence of a file.

This was developed to be used to stop respawns of a daemon that was started in
response to a udev hotplug event, but it is generally applicable to many other
scenarios.
2012-10-02 19:33:18 +00:00
Laurence Withers
b17eed9466 SIGTERM handler: use _exit(2), not exit(3)
exit(3) is not async-signal safe (presumably due to atexit(3) processing),
so use _exit(2) instead. This was clearly an omission from the original
code which even had a comment to the effect that _exit(2) needed to be
used. In all likelihood this never caused any problems as atexit(3)
functionality is not used.
2012-10-02 18:52:11 +00:00
Laurence Withers
b26bd15791 Treat SIGINT similarly to SIGTERM
Treat SIGINT similarly to SIGTERM; exit when it is received. This gives the
desired behaviour of having a foreground daemonitor be stopped by pressing
ctrl-C on its controlling tty.
2012-10-02 18:50:46 +00:00
Laurence Withers
f611c2acf7 Update build system 2012-10-02 09:54:56 +00:00
Laurence Withers
4a50315f12 Bump version 1.0.2 2009-04-06 15:00:26 +00:00
Laurence Withers
45bbf6bf1c Upgrade build system 2009-04-06 15:00:13 +00:00
Laurence Withers
f18e14a104 Bump version 1.0.1 2008-08-26 22:15:03 +00:00
Laurence Withers
92e8e92c69 Fix corruption when logging to syslog
syslog(3) used instead of vsyslog(3). Caused corruption in resultant
messages (usually in function name).
2008-08-26 22:13:43 +00:00
Laurence Withers
d834d82b89 Bump version 1.0.0 2008-07-26 20:56:50 +00:00
Laurence Withers
b0c867224f Add sensible SIGTERM handling (propagate it to the child), etc. 2008-07-26 20:54:14 +00:00
Laurence Withers
92ec05ab67 Save and restore errno before using %m specifier 2008-07-26 20:47:49 +00:00
Laurence Withers
38b6caa6f9 Add ability to override environment variables for child process 2008-07-26 18:10:04 +00:00
Laurence Withers
340c72f9e2 Add a nice timestamp to the output of log file messages 2008-07-26 17:45:52 +00:00
Laurence Withers
9c3a85f824 Fix closing all file descriptors and logging errors 2008-07-26 17:38:04 +00:00
Laurence Withers
4f17e0b6d2 Clean up printing to PID file and logging of that 2008-07-26 17:30:35 +00:00
Laurence Withers
67f0ab405a Remember that execve()'s argv[0] is the program name 2008-07-26 17:28:18 +00:00
Laurence Withers
4c1a3943bd Add run_program() implementation 2008-07-26 17:24:19 +00:00
Laurence Withers
0015f9c660 Use more logical file names 2008-07-26 16:58:31 +00:00
Laurence Withers
b626776876 Add mechanism to restart programs 2008-07-26 16:58:16 +00:00
Laurence Withers
1ff8b24650 Add/tidy up commandline options 2008-07-26 16:47:03 +00:00
Laurence Withers
f2f2baa129 Add daemonising routines 2008-07-26 16:40:24 +00:00
Laurence Withers
529c50212b Add PID file support 2008-07-26 16:11:34 +00:00
Laurence Withers
92606e58e2 Add more logging infrastructure 2008-07-26 15:33:56 +00:00
Laurence Withers
ff1f6fb734 Add basic daemonitor build framework and logging infrastructure 2008-07-26 15:19:13 +00:00
Laurence Withers
e2fc9d8088 Import skeleton of daemonitor 2008-07-26 14:45:31 +00:00