1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41
|
1) Compile (type 'make'). This should create two binaries, 'uptimed' and
'uprecords'. If the programs do not compile, try hacking the source and
send me some patches, or wait for a next release. =p
2) As root, type 'make install'. This will place the binaries in
/usr/local/sbin and /usr/local/bin.
3) To start the program automatically everytime you start up your computer,
add the following lines to your computers start-up file.
echo "Creating unique uptime daemon bootid..."
/usr/local/sbin/uptimed -boot
For Slackware, add it somewhere in /etc/rc.d/rc.S
For Debian, put it in a file in /etc/init.d/ and symlink it from /etc/rc.S
For RedHat, add it somewhere in /etc/rc.d/rc.sysinit
The -boot flag is essential: it updates the /var/run/uptimed.bootid file
resulting in a unique id per boottime. This must be done in rc.S and not
in rc.local to make sure the bootid stays intact even when switching
runlevels. When using the -boot flag, uptimed exits on purpose. Add
echo "Starting uptime daemon..."
/usr/local/sbin/uptimed
to rc.local. This will start the daemon when going multiuser without
altering the bootid.
Any better suggestions for having a unique bootid are welcome. Note
however that the btime in /proc/stat is calculated as systemtime - uptime
and is not static. Therefore rdate, clock and timezone changes could
change it making it unreliable unless it is only being written once at
boottime. So far having a -boot switch and using rc.S in addition to
rc.local is the only solution I have come up with that works - apart from
a kernel patch to have a static (and not calculated) btime entry
somewhere in /proc.
4) To see the records, type 'uprecords'. The current session will be
highlighted. You will probably only see one entry the first time you run
the program. If that bothers you, reboot a few times. ;) Uptimed will log
no more than 10 entries by default.
|