is there any way to create a daemon in unix that would monitor my battery level and notify me after the crtic开发者_Go百科al level. and is there any way to identify a node that is joining and leaving a network using c
As a solution to both problems (and assuming by "unix" you mean "Linux"), you could look into using DBus: http://www.freedesktop.org/wiki/Software/dbus
I know Ubuntu has daemons running by default which trigger DBus events when network connections change and there are standard endpoints for things like current battery charge.
Look for information on DBus network manager and perhaps try this project for the power monitoring portion: http://powersave.sourceforge.net/powersave/DBus.html
It may be a good start for you: http://ubuntuforums.org/showthread.php?t=367978
acpi -b
ACPI project: http://www.lesswatts.org/projects/acpi/
Peeking into apcupsd may be useful.
精彩评论