04-18-2009
Need advice on coding a daemon
I hope this is the right forum to post this.
I need a little advice on something.
I want to create a daemon to run on a Linux server and this daemon should:
1. capture the `./configure` command so that it knows where a program installed via source would store it's binaries and, most importantly, configuration files.
2. somehow capture package manager activity so that it knows where the programs binaries and configuration files are.
3. detect when a service is started or stopped or restarted...basically, detect the change in status of a service. How does Linux know when a service is triggered? Is a /proc file or something like that triggered?
Would a daemon coded in Python work here? Also, what are the best options to capture a commands activity? strace? gdb?
For #1, I thought of just having my program read the bottom of the man's to get the location of the config files but a lot of programs don't have such details man's on Linux :/
My aim is to basically make a little program that self documents so that, for example, if an admin decides to install the latest PHP on a web server, compiled from source since the package manager doesn't have the latest version, my program should save that information to a file somewhere.
Any ideas?
6 More Discussions You Might Find Interesting
1. UNIX for Advanced & Expert Users
I apologise because I had pasted this question in the newbies forum first (because i am a bit of a newbie) but thought it might be better suited in here
if i have to sepearate parameters can I use this syntax especially the or part (||) and is this correct
if (6 Replies)
Discussion started by: w33man
6 Replies
2. UNIX for Dummies Questions & Answers
Hi All,
I am new to pro*C. I have a select statement as
select a.ename,a.sal,a.empno from emp where &n=(select count(distinct(b.sal)) from emp b where a.sal<=b.sal
for this query I have to write a pro*C program. So can you please send me the complete code. Then I will foloow the same... (1 Reply)
Discussion started by: user71408
1 Replies
3. Programming
for a floating-point array x whose size is n, find the geometric mean..
GM =n x1.x2.x3...xn (2 Replies)
Discussion started by: allyjaah
2 Replies
4. Shell Programming and Scripting
I have the following Phyton script and want to print something if the option was selected
For example if the user uses --npop=12, I want to check if the user has inputted --npop and
do
if npop selected, print npop
Or if the user puts --fdata=npt02.dat I print something like
if fdata... (3 Replies)
Discussion started by: kristinu
3 Replies
5. Shell Programming and Scripting
HI,
Can some one guide me how to make changes to the script below so that it can load the history of a program to IT server ?
Format of data:
YYYYMMDD065959.dsk.log
YYYYMMDD235959.dsk.log
currently both are loaded together. Need to separate them as above format.
Thanks in advance.
... (1 Reply)
Discussion started by: crazydude80
1 Replies
6. Windows & DOS: Issues & Discussions
HI,
Can some one guide me how to make changes to the script below so that it can load the history of a program to IT server ?
Format of data:
YYYYMMDD065959.dsk.log
YYYYMMDD235959.dsk.log
currently both are loaded together. Need to separate them as above format.
Thanks in advance.
... (2 Replies)
Discussion started by: crazydude80
2 Replies
HALD(8) System Manager's Manual HALD(8)
NAME
hald - HAL daemon
SYNOPSIS
hald [options]
DESCRIPTION
hald is a daemon that maintains a database of the devices connected to the system system in real-time. The daemon connects to the D-Bus
system message bus to provide an API that applications can use to discover, monitor and invoke operations on devices. For more information
about both the big picture and specific API details, refer to the HAL spec which can be found in /usr/share/doc/hal-doc/spec/hal-spec.html
depending on the distribution.
OPTIONS
The following options are supported:
--daemon=yes|no
Specify whether to run in the foreground or the background.
--verbose=yes|no
Enable verbose debug output.
--use-syslog
Enable logging of debug output to the syslog instead of stderr. Use this option only together with --verbose.
--help Print out usage.
--version
Print the version of the daemon and exit.
BUGS AND DEBUGGING
Please send bug reports to either the distribution or the HAL mailing list, see http://lists.freedesktop.org/mailman/listinfo/hal on how to
subscribe.
First, to obtain useful debug traces you will need to have debuginfo packages installed. On a Fedora system this is in the hal-debuginfo
package and can be installed via the yum update program.
Second, shut down the existing hald daemon instance; on a Fedora system this is achieved by
/etc/init.d/haldaemon stop
After having shut down the daemon, you might want to run
pkill hald
to ensure that all the helper processe of hald are killed too. To start the HAL daemon, use
/usr/sbin/hald --daemon=no --verbose=yes
If the daemon crashes, you can start it under a debugger via
gdb /usr/sbin/hald
and then typing
run --daemon=no --verbose=yes
at the (gdb) prompt. To capture a back trace, use the bt command and attach this to the bug report.
Please also attach the output of lshal(1) in the bug report if possible (it's not possible if the hald daemon crashed). If the nature of
the bug has to do with hotplugging, attach two outputs of lshal(1) - one before the device hotplug event and one after.
SEE ALSO
udev(7), dbus-daemon(1), lshal(1), hal-set-property(1), hal-get-property(1), hal-find-by-property(1), hal-find-by-capability(1), hal-is-
caller-locked-out(1)
AUTHOR
Written by David Zeuthen <david@fubar.dk> with a lot of help from many others.
HALD(8)