From: Joe Z. <jz...@us...> - 2003-04-24 06:16:30
|
Update of /cvsroot/bobs/bobs In directory sc8-pr-cvs1:/tmp/cvs-serv31230/bobs Modified Files: Makefile.in admin.php configure configure.in Added Files: systemcheck.php Log Message: Created a page to check bobs configuration: systemcheck.php --- NEW FILE: systemcheck.php --- <?php // systemcheck.php - Verify bobs is configured properly and working if (isset($_GET['menu_bobs'])){ // BOBS menu button pushed $bobsdir = dirname($_SERVER['PHP_SELF']); header("Location: $bobsdir"); // Redirect browser to BOBS main index exit; // Make sure that code below does not get executed } require_once ('inc/class_rfasttemplate.php'); // Template class require_once("inc/class_config.php"); // configuration class include("inc/header.pinc"); // Main menu $config = new config(); // Create instance of configuration class $t = new rFastTemplate ('inc/templates'); $t->define (array('content' => 'systemcheck.thtml')); $t->define_dynamic (array ('item' => 'content', 'help' => 'content')); // Heading $t->assign ('TITLE', 'System check'); $t->parse ('CONTENT', 'content'); echo ($t->fetch()); // -------------------------------- // Site root // -------------------------------- $siteroot = $config->get_siteroot(); $t->assign ('ITEM', "Bobs site root directory is $siteroot"); if (strlen($siteroot) <= 0){ $t->assign ('STATUS', 'FAIL'); $t->assign ('HELP', "Siteroot is not set in config.php.<br> Reinstall bobs or manually edit the config.php file in bobs web directory."); putfail(); } else { $t->assign ('STATUS', 'PASS'); putpass(); } $t->assign ('ITEM', "Checking if $siteroot exists"); if (is_dir($siteroot)) { $t->assign ('STATUS', 'PASS'); putpass(); } else { $t->assign ('STATUS', 'FAIL'); $t->assign ('HELP', "siteroot directory $siteroot does not exist.<br> Bobs is not properly installed. Reinstall bobs."); putfail(); } $t->assign ('ITEM', "Checking if $siteroot is readable"); if (is_readable($siteroot)) { $t->assign ('STATUS', 'PASS'); putpass(); } else { $t->assign ('STATUS', 'FAIL'); $t->assign ('HELP', "Siteroot directory $siteroot is not readable.<br> Check the directory permissions or reinstall bobs."); putfail(); } // -------------------------------- // Server directory // -------------------------------- $serverdir = $siteroot . '/inc/servers'; $t->assign ('ITEM', "Checking if $serverdir exists"); if (is_dir($serverdir)) { $t->assign ('STATUS', 'PASS'); putpass(); } else { $t->assign ('STATUS', 'FAIL'); $t->assign ('HELP', "Servers directory $serverdir does not exist.<br> Bobs is not properly installed. Reinstall bobs."); putfail(); } $httpduser = rtrim(`whoami`); $t->assign ('ITEM', "Web server is running as user id $httpduser"); $t->assign ('STATUS', 'INFO'); putpass(); $serverdir = $siteroot . '/inc/servers'; $t->assign ('ITEM', "Checking if $serverdir is writeable by $httpduser"); if (is_writeable($serverdir)) { $t->assign ('STATUS', 'PASS'); putpass(); } else { $t->assign ('STATUS', 'FAIL'); $t->assign ('HELP', "$httpduser can't write to $serverdir.<br> Run these commands as root:<br> chown $httpduser.root $serverdir<br> chmod 755 $serverdir"); putfail(); } // -------------------------------- // Default password // -------------------------------- $t->assign ('ITEM', "Checking if default administrator password has been changed"); if ($config->admin_pwd != 'admin'){ $t->assign ('STATUS', 'PASS'); putpass(); } else { $t->assign ('STATUS', 'WARN'); $t->assign ('HELP', "The default administrator password has not been changed.<br> See the bobs INSTALL document."); putfail(); } // -------------------------------- // Data directory // -------------------------------- $datadir = $config->get_datadir(); $t->assign ('ITEM', "Bobs data directory is $datadir"); if (strlen($datadir) <= 0){ $t->assign ('STATUS', 'FAIL'); $t->assign ('HELP', "datadir is not set in config.php.<br> Reinstall bobs or manually edit the config.php file in bobs web directory."); putfail(); } else { $t->assign ('STATUS', 'PASS'); putpass(); } $t->assign ('ITEM', "Checking if $datadir exists"); if (is_dir($datadir)) { $t->assign ('STATUS', 'PASS'); putpass(); } else { $t->assign ('STATUS', 'FAIL'); $t->assign ('HELP', "Bobs data directory $datadir does not exist.<br> Bobs is not properly installed. Reinstall bobs."); putfail(); } $backupdir = $config->get_backupdir(); $t->assign ('ITEM', "Checking if $backupdir is writeable by $httpduser"); if (is_writeable($backupdir)) { $t->assign ('STATUS', 'PASS'); putpass(); } else { $t->assign ('STATUS', 'FAIL'); $t->assign ('HELP', "$httpduser can't write to $backupdir.<br> Run these commands as root:<br> chown $httpduser.root $backupdir<br> chmod 755 $backupdir"); putfail(); } $incomingdir = $config->get_incomingdir(); $t->assign ('ITEM', "Checking if $incomingdir is writeable by $httpduser"); if (is_writeable($incomingdir)) { $t->assign ('STATUS', 'PASS'); putpass(); } else { $t->assign ('STATUS', 'FAIL'); $t->assign ('HELP', "$httpduser can't write to $incomingdir.<br> Run these commands as root:<br> chown $httpduser.root $incomingdir<br> chmod 755 $incomingdir"); putfail(); } $incrementdir = $config->get_incrementdir(); $t->assign ('ITEM', "Checking if $incrementdir is writeable by $httpduser"); if (is_writeable($incrementdir)) { $t->assign ('STATUS', 'PASS'); putpass(); } else { $t->assign ('STATUS', 'FAIL'); $t->assign ('HELP', "$httpduser can't write to $incrementdir.<br> Run these commands as root:<br> chown $httpduser.root $incrementdir<br> chmod 755 $incrementdir"); putfail(); } $freespace = disk_free_space($backupdir); $meg = round($freespace / 1024 / 1024); $t->assign ('ITEM', "Free space in $backupdir is $meg M"); if ($meg >= 100) { $t->assign ('STATUS', 'PASS'); putpass(); } else { $t->assign ('STATUS', 'FAIL'); $t->assign ('HELP', "You only have $meg megabytes of free space on $backupdir."); putfail(); } // -------------------------------- // Check cron daily and backup.php // -------------------------------- $crondir = $config->get_crondir(); $t->assign ('ITEM', "Bobs cron daily directory is $crondir"); if (strlen($crondir) <= 0){ $t->assign ('STATUS', 'FAIL'); $t->assign ('HELP', "The location of the daily cron files has not been set.<br> This is usually /etc/cron.daily/.<br> Reinstall bobs and manually specify --with-crondir=DIR<br> if it is not set automatically."); putfail(); } else { $t->assign ('STATUS', 'PASS'); putpass(); } $cronbackup = $crondir . '/backup.php'; $t->assign ('ITEM', "Checking if $cronbackup exists and is executable"); if (is_executable($cronbackup)) { $t->assign ('STATUS', 'PASS'); putpass(); } else { $t->assign ('STATUS', 'FAIL'); $t->assign ('HELP', "$cronbackup either doesn't exist or is not executable.<br> Run ./configure from the install directory and<br> see if 'cron directory = /etc/cron.daily'"); putfail(); } // -------------------------------- // Check crontab // -------------------------------- $crontabdir = $config->get_crontabdir(); $t->assign ('ITEM', "The crontab directory is $crontabdir"); if (strlen($crontabdir) <= 0){ $t->assign ('STATUS', 'FAIL'); $t->assign ('HELP', "The location of the crontab file has not been set.<br> This is usually /etc.<br> Reinstall bobs and manually specify --with-crontabdir=DIR<br> if it is not set automatically."); putfail(); } else { $t->assign ('STATUS', 'PASS'); putpass(); } $crontab = $crontabdir . '/crontab'; $t->assign ('ITEM', "Checking for $crontab"); if (is_file($crontab)) { $t->assign ('STATUS', 'PASS'); putpass(); } else { $t->assign ('STATUS', 'FAIL'); $t->assign ('HELP', "I can't find $crontab. What the heck?!"); putfail(); } $cronline = `grep 'current/process/check_loop' $crontab`; if (strlen($cronline) > 0) { $t->assign ('ITEM', "Checking for check_loop in $crontab<br> $cronline"); $t->assign ('STATUS', 'PASS'); putpass(); } else { $t->assign ('ITEM', "Checking for check_loop in $crontab"); $t->assign ('STATUS', 'FAIL'); $t->assign ('HELP', "check_loop doesn't seem to be in $crontab.<br> Reinstall bobs."); putfail(); } $pid = `/sbin/pidof -x check_loop`; if (strlen($pid) > 0) { $t->assign ('ITEM', "Checking for running check_loop process<br> check_loop process id is $pid"); $t->assign ('STATUS', 'PASS'); putpass(); } else { $t->assign ('ITEM', "Checking for running check_loop process"); $t->assign ('STATUS', 'FAIL'); $t->assign ('HELP', "check_loop doesn't seem to be running.<br> See $crontab and/or reinstall bobs."); putfail(); } $pid = rtrim(`/sbin/pidof -x cmdloop`); if (strlen($pid) > 0) { $t->assign ('ITEM', "Checking for running cmdloop process<br> cmdloop process id is $pid"); $t->assign ('STATUS', 'PASS'); putpass(); } else { $t->assign ('ITEM', "Checking for running cmdloop process"); $t->assign ('STATUS', 'FAIL'); $t->assign ('HELP', "cmdloop doesn't seem to be running.<br> If you just installed bobs, wait 5 minutes and check again,<br> otherwise see $crontab and/or reinstall bobs."); putfail(); } // -------------------------------- // database support // -------------------------------- $t->assign ('ITEM', "Checking for dba database support"); if (extension_loaded("dba")) { $t->assign ('STATUS', 'PASS'); putpass(); } else { $t->assign ('STATUS', 'FAIL'); $t->assign ('HELP', "dba database support is not loaded.<br> You need to check your php configuration and include dba support."); putfail(); } $t->assign ('ITEM', "Checking for db3 database support"); $tempfile = '/tmp/bobstest' . posix_getpid(); $handle = dba_open("$tempfile", "c", "db3"); // open a temporary database if ($handle) { dba_close($handle); // close it unlink($tempfile); // and delete it. $t->assign ('STATUS', 'PASS'); putpass(); } else { $t->assign ('STATUS', 'FAIL'); $t->assign ('HELP', "db3 database support is not working.<br> You need to check your php configuration and<br> include db3 database support."); putfail(); } $t->parse ('ROW', 'endtable'); // end the table echo ($t->fetch()); echo "</body></html>\n"; // End the html page // ---------------------------- // Output a passed template row // ---------------------------- function putpass(){ global $t; $t->parse ('ROW', 'itempass'); echo ($t->fetch()); $t->clear_dynamic ('itempass'); } // ---------------------------- // Output a failed template row // ---------------------------- function putfail(){ global $t; $t->parse ('ROW', 'itemfail'); echo ($t->fetch()); $t->clear_dynamic ('itemfail'); $t->parse ('HELP', 'help'); echo ($t->fetch()); $t->clear_dynamic ('help'); } return; Index: Makefile.in =================================================================== RCS file: /cvsroot/bobs/bobs/Makefile.in,v retrieving revision 1.9 retrieving revision 1.10 diff -u -d -r1.9 -r1.10 --- Makefile.in 20 Apr 2003 08:02:51 -0000 1.9 +++ Makefile.in 24 Apr 2003 06:15:56 -0000 1.10 @@ -88,6 +88,8 @@ myPASS = @myPASS@ myWEBDIR = @myWEBDIR@ myrealBOBSDATA = @myrealBOBSDATA@ +myrealCRONDIR = @myrealCRONDIR@ +myrealCRONTABDIR = @myrealCRONTABDIR@ myrealWEBDIR = @myrealWEBDIR@ SUBDIRS = bash doc cron images inc js winc man Index: admin.php =================================================================== RCS file: /cvsroot/bobs/bobs/admin.php,v retrieving revision 1.17 retrieving revision 1.18 diff -u -d -r1.17 -r1.18 --- admin.php 24 Mar 2003 05:37:39 -0000 1.17 +++ admin.php 24 Apr 2003 06:15:56 -0000 1.18 @@ -2,7 +2,7 @@ // BOBS Administration Interface -if (isset($_GET['menu_bobs'])){ // BOBS menu button pushed +if (isset($_GET['menu_bobs'])){ // BOBS menu button pushed $bobsdir = dirname($_SERVER['PHP_SELF']); header("Location: $bobsdir"); // Redirect browser to BOBS main index exit; // Make sure that code below does not get executed @@ -108,7 +108,7 @@ select_server(); // Back to server selection screen break; default: - echo "DEFAULT!"; + echo "That function is not yet implemented."; break; } Index: configure =================================================================== RCS file: /cvsroot/bobs/bobs/configure,v retrieving revision 1.8 retrieving revision 1.9 diff -u -d -r1.8 -r1.9 --- configure 20 Apr 2003 08:02:51 -0000 1.8 +++ configure 24 Apr 2003 06:15:56 -0000 1.9 @@ -272,7 +272,7 @@ ac_unique_file="admin.php" ac_default_prefix='' -ac_subst_vars='SHELL PATH_SEPARATOR PACKAGE_NAME PACKAGE_TARNAME PACKAGE_VERSION PACKAGE_STRING PACKAGE_BUGREPORT exec_prefix prefix program_transform_name bindir sbindir libexecdir datadir sysconfdir sharedstatedir localstatedir libdir includedir oldincludedir infodir mandir build_alias host_alias target_alias DEFS ECHO_C ECHO_N ECHO_T LIBS INSTALL_PROGRAM INSTALL_SCRIPT INSTALL_DATA PACKAGE VERSION ACLOCAL AUTOCONF AUTOMAKE AUTOHEADER MAKEINFO AMTAR install_sh STRIP ac_ct_STRIP INSTALL_STRIP_PROGRAM AWK SET_MAKE myWEBDIR myBOBSDATA myCRONDIR myCRONTABDIR myMANDIR myPASS myHTTPDUSER myrealBOBSDATA myrealWEBDIR LIBOBJS LTLIBOBJS' +ac_subst_vars='SHELL PATH_SEPARATOR PACKAGE_NAME PACKAGE_TARNAME PACKAGE_VERSION PACKAGE_STRING PACKAGE_BUGREPORT exec_prefix prefix program_transform_name bindir sbindir libexecdir datadir sysconfdir sharedstatedir localstatedir libdir includedir oldincludedir infodir mandir build_alias host_alias target_alias DEFS ECHO_C ECHO_N ECHO_T LIBS INSTALL_PROGRAM INSTALL_SCRIPT INSTALL_DATA PACKAGE VERSION ACLOCAL AUTOCONF AUTOMAKE AUTOHEADER MAKEINFO AMTAR install_sh STRIP ac_ct_STRIP INSTALL_STRIP_PROGRAM AWK SET_MAKE myWEBDIR myBOBSDATA myCRONDIR myCRONTABDIR myMANDIR myPASS myHTTPDUSER myrealBOBSDATA myrealWEBDIR myrealCRONDIR myrealCRONTABDIR LIBOBJS LTLIBOBJS' ac_subst_files='' # Initialize some variables set by options. @@ -1761,6 +1761,18 @@ )` +myrealCRONDIR=`( + test "x$prefix" = xNONE && prefix=$ac_default_prefix + eval echo "$myCRONDIR" +)` + + +myrealCRONTABDIR=`( + test "x$prefix" = xNONE && prefix=$ac_default_prefix + eval echo "$myCRONTABDIR" +)` + + ac_config_files="$ac_config_files inc/config.php cron/backup.php cron/check_loop" cat >confcache <<\_ACEOF # This file is a shell script that caches the results of configure @@ -2438,6 +2450,8 @@ s,@myHTTPDUSER@,$myHTTPDUSER,;t t s,@myrealBOBSDATA@,$myrealBOBSDATA,;t t s,@myrealWEBDIR@,$myrealWEBDIR,;t t +s,@myrealCRONDIR@,$myrealCRONDIR,;t t +s,@myrealCRONTABDIR@,$myrealCRONTABDIR,;t t s,@LIBOBJS@,$LIBOBJS,;t t s,@LTLIBOBJS@,$LTLIBOBJS,;t t CEOF @@ -2688,4 +2702,5 @@ echo "" echo "*** $WARNCOUNT warning(s)" echo "" + Index: configure.in =================================================================== RCS file: /cvsroot/bobs/bobs/configure.in,v retrieving revision 1.10 retrieving revision 1.11 diff -u -d -r1.10 -r1.11 --- configure.in 20 Apr 2003 08:02:52 -0000 1.10 +++ configure.in 24 Apr 2003 06:15:56 -0000 1.11 @@ -156,6 +156,18 @@ )` AC_SUBST(myrealWEBDIR) +myrealCRONDIR=`( + test "x$prefix" = xNONE && prefix=$ac_default_prefix + eval echo "$myCRONDIR" +)` +AC_SUBST(myrealCRONDIR) + +myrealCRONTABDIR=`( + test "x$prefix" = xNONE && prefix=$ac_default_prefix + eval echo "$myCRONTABDIR" +)` +AC_SUBST(myrealCRONTABDIR) + AC_OUTPUT([ inc/config.php cron/backup.php @@ -177,6 +189,7 @@ echo "" echo "*** $WARNCOUNT warning(s)" echo "" + dnl> echo "The following is just for testing and will be removed:" dnl> echo "" dnl> echo "prefix: ${prefix}" |