

	Upd

	(C) 2000 Stephan Dragehjerte,
	tisprut productions [tm] <stephan@nerd.dk>
	http://linux.e.iha.dk/~stephan




	TABLE OF CONTENTS:

	o   ABOUT
	o   LICENSE

	o   INSTALLATION AUTOMATICALLY
	o   UPGRADING AUTOMATICALLY

	o   INSTALLATION MANUALLY
	o   UPGRADING MANUALLY

	o   VIEWING THE HISCORES
	o   HTML HISCORES

	o   A FEW WORDS ABOUT config.h
	o   Y2K PREPARED
	o   WARRENTY
	o   BUGS
	o   CONTACT
	




	ABOUT
	-----

	Upd is an uptime daemon; a lille program that keeps track of how
	long your machines has been up without begin turned off or rebooted.
	It generates a hiscore in both text and HTML with the top best
	uptimes, which can be viewed any time, any where.

	It's an easy and fun program for everyone; young or old; fat or
	skinny; green or blue; everyone loves the upd!
	The upd makes so little noise that you can use it, while you're
	watching your favorite TV pseudo talk show, at work or even while
	you're at sleep.
	And after use it stores away easily under a bed, behind a door
	or in a closet.

	But wait, there's more!

	It cooks, it bakes, it fries, it boils, it toasts, it crisps,
	it steams, it even makes the most delicious food so disgusting,
	not even the sick cat will have it.

	But wait, there's more!!

	Ever wanted to get rid of that fat ass of yours?  Well, upd is the
	answer!  Compile it, install it and run it.
	Independent research results show that even after three weeks,
	you'll start loosing weight!

	Order now!

	If you order now, we'll include this beautiful painting in a real
	gold frame as a free bonus!  It is stuiable for any occation, and
	makes the perfect atmosphere in any room you place it.

	Operators are waiting to serve YOUR orders NOW!  Call NOW!





	LICENSE
	-------

	Upd is under the GPL.  For more information read:
	http://www.gnu.org/copyleft/copyleft.html





	INSTALLATION AUTOMATICALLY
	--------------------------

	This installation method can be tricky!
	It is made to work with RedHat systems with Apache built and
	installed manually (that is from .tar.gz and NOT .rpm).

	If your files are located elsewhere, you should use the manual
	installation method mentioned below.
	You can also just modify Makefile and config.h to fit your system,
	which should not be a problem, if you know how to do it properly.

	System start-up scripts should be located here:

	    /etc/rc.d/init.d
	    /etc/rc.d/rc.3
	    /etc/rc.d/rc.5

	Apache (prefix) should be located here:

	    /usr/local/apache


	Switch uid to root and install the program.

	o   $su
	o   #make install_upd

	If this is a new installation, you must install the data files:

	o   #make install_data

	And optionally modify your startup scripts to start upd
	automatically at boot-time:

	o   #make install_scripts

	Finally start upd:

	o   #make start

	If this works smoothly then  make uninstall  will work also.



	UPGRADING AUTOMATICALLY
	-----------------------

	The same thing regarding file locations in the section
	``INSTALLATION (AUTOMATICALLY)'' is also required here.
	If not then either modify Makefile and config.h or
	follow instructions in section the ``UPGRADING (MANUALLY)''.

	Switch uid to root and upgrade the program:

	o   $su
	o   #make upgrade

	If this works smoothly then  make uninstall  will work also.





	INSTALLATION MANUALLY
	---------------------

	First you need to compile the program:

	o  $make

	Switch uid to root and install the program in a directory pointed to
	in your PATH and put the HTML template file into your HTML document dir
	together with the PHP demo:

	o   $su
	o   #cp ./upd /usr/local/bin
	o   #cp ./upd.template.html /usr/local/apache/htdocs
	o   #cp ./upd.cgi /usr/local/apache/cgi-bin
	o   #cp ./upd.php3 /usr/local/apache/htdocs

	Create the necessary directory for upd to store its data files
	and set the directory's permissions:

	o   #mkdir /usr/local/lib/upd
	o   #chmod 755 /usr/local/lib/upd
	o   #touch /usr/local/lib/upd/upd.hiscores

	If and only if you are installing upd for the first time
	execute this command:

	o   #touch /usr/local/lib/upd/upd.tmp

	Now modify your start-up scripts (for example /etc/rc.d/rc.local)
	to launch upd upon reboot.  Simply insert this line:

	o   #/usr/local/bin/upd start




	UPGRADING MANUALLY
	------------------

	First back-up your current (old formatted) hiscore file:

	o   #cp /usr/local/lib/upd/upd.hiscores /tmp/upd.hiscores.OLD

	Now compile the program and the convertion utility:

	o   #make

	Switch uid to root.  Now removed the tmp file (upd.tmp) and stop upd.
	Everytime upd is started, it thinks the system as crashed and has
	been restarted.  This way we trick it to not update the hiscore list
	from the tmp file.  (Olay, we made a back-up of the hiscores already,
	so this really isn't necessary, but let's do it the correct way
	anyway, shall we?):

	o   #su
	o   $rm /usr/local/lib/upd/upd.tmp
	o   $upd stop

	Now copy the new upd on top of the old:

	o   $cp ./upd /usr/local/bin

	And convert the old hiscore file to a new formatted hiscore file:

	o   $updconvert /tmp/upd.hiscore.OLD /usr/local/lib/upd/upd.hiscores

	Finally launch the new upd:

	o   $/usr/local/bin/upd start
	
	Now, if you view your hiscores, upd will complain about some tmp
	file missing.  Either ignore this because one will be created
	shortly (REFRESH in config.h) or if you cannot stand it, make one
	yourself:

	o   $touch /usr/local/lib/upd/upd.tmp

	Voil!




	VIEWING THE HISCORES
	--------------------


	While normal users are not supposed to start the daemon,
	they can of course still view the hiscores:

	o   $upd

	or:

	o   $upd top

	At your IRC client's prompt (ircii or epic) type:

	o   /exec -o upd

	Users can of course also read the HTML hiscore file generated by upd:

	o   $lynx http://localhost/cgi-bin/upd.cgi

	And the PHP file as well:

	o   $lynx http://localhost/upd.php3

	If you run PHP in safe_mode, make sure /usr/local/bin is added
	in the safe_mode_dir so upd can be reached.
	See your /usr/local/lib/php.ini.




	HTML HISCORES
	-------------

	Upd can generate a HTML file with the hiscores.
	It does this by reading the HTML_TEMPLATE file (defined in config.h)
	line by line, and writing it to stdout (the screen).

	The line containing HTML_TAG will be replaced by the hiscores typeset
	in a HTML table.
	Note the HISCORE_TAG is case sensitive and must match exactly.

	While having the HTML output directly on screen has no obvious usage,
	it can be directed to a file of choise for later view with a browser:

	  $upd html > /usr/local/apache/htdocs/upd.html

	This could be used as a crontab job so the HTML hiscore file is
	written every ten minutes:

	   */10 * * * *
	   /usr/local/bin/upd html > /usr/local/apache/htdocs/upd.html

	Or upd can be run from a simple CGI shell script and let HTML table
	be generated at run time:

	   #!/bin/sh
	   echo -e "Content-Type: text/html\n";
	   /usr/local/bin/upd html

	Remember to set the script +x so it can be executed (man chmod).





	A FEW WORDS ABOUT config.h
	--------------------------

	Upd supports two date formats in its hiscore files (data and HTML):
	DD-MM-YY and MM-DD-YY.
	Choose one format by defining it as 1, and the other as 0.
	Default is DD-MM-YY.

	If you run upd on a server and want it to go into suspend mode
	once in a while, so the hardware can relax, you should change
	the REFRESH rate.  This is how frequency which the upd.tmp
	containing system uptime is written.  New uptime hiscores are read
	from this file, so if REFRESH is set too long then you might loose
	some time in the hiscore table.  If the machine is constantly busy
	anyway, forget about all I just wrote =).

	The rest is given, I think.





	Y2K PREPARED
	------------------

	Aparrently yes.  But is it Y2K+1 prepared?





	WARRENTY
	--------

	None.





	BUGS 
	----

	None I know of besides the slightly annoying thing about the
	upd.tmp file, which has to be deleted before upd is restarted
	``abnormally'' (when upgrading).  This problem is mentioned
	in section ``UPGRADING MANUALLY''.





	CONTACT
	-------

	If you find any, please mail me about them.  Suggestions, corrections,
	hellos, flames and porno is welcome as well =).

	Newest version avaiable at your local tisprut productions [tm] dealer,
	http://linux.e.iha.dk/~stephan/Programmer/Side1

	I can be reach via IRC on #linux.dk@undernet and #blender3d@efnet,
	nickname Zta.

	Enjoy,
	Stephan Dragehjerte <stephan@nerd.dk>
	http://linux.e.iha.dk/~stephan




