From: Joe Z. <jz...@us...> - 2003-05-01 05:21:18
|
Update of /cvsroot/bobs/bobs In directory sc8-pr-cvs1:/tmp/cvs-serv27119/bobs Modified Files: ChangeLog TODO lookadmin.css systemcheck.php Log Message: Fixup systemcheck.php: Create mount directories if they don't exist. Test rsync. Index: ChangeLog =================================================================== RCS file: /cvsroot/bobs/bobs/ChangeLog,v retrieving revision 1.7 retrieving revision 1.8 diff -u -d -r1.7 -r1.8 --- ChangeLog 20 Apr 2003 08:02:51 -0000 1.7 +++ ChangeLog 1 May 2003 05:21:14 -0000 1.8 @@ -8,6 +8,13 @@ When backing up multiple servers using nfs, one of the nfs shares stays mounted. + Joe Zacky ( jz...@us... ) + -- 4-18-2003 + Wrote a minimal man page: 'man bobs'. + -- 4-26-2003 + Create a "Check Configuration" option on the admin page. + Admins need to be able to test if a setup works. + Version 0.6.0pre1 Rene Rask (re...@gr...) -- Generating dir trees on backup. Index: TODO =================================================================== RCS file: /cvsroot/bobs/bobs/TODO,v retrieving revision 1.15 retrieving revision 1.16 diff -u -d -r1.15 -r1.16 --- TODO 26 Apr 2003 22:39:43 -0000 1.15 +++ TODO 1 May 2003 05:21:14 -0000 1.16 @@ -26,10 +26,6 @@ Priority: Medium It's currently hardcoded, but should be easy to move. -Create a "test server" option on the admin pages. - Priority: Medium - Admins need to be able to test if a setup works. - Add security. Priority: Medium Backup directories (/var/bobsdata/) should not be world readable. @@ -65,6 +61,12 @@ Write man/info pages Priority: Low + +Add "Backup Now" button under "Check Configuration" button. + Priority: Medium + This will add the final touch to testing the server setup + and allow people to run backups on demand. + Use interprocess communication like systemcheck.php does. --- End of Murray's Suggestions --- ----- WISHLIST ------ Index: lookadmin.css =================================================================== RCS file: /cvsroot/bobs/bobs/lookadmin.css,v retrieving revision 1.1 retrieving revision 1.2 diff -u -d -r1.1 -r1.2 --- lookadmin.css 26 Apr 2003 22:39:43 -0000 1.1 +++ lookadmin.css 1 May 2003 05:21:14 -0000 1.2 @@ -1,12 +1,14 @@ body { color: black; font-style: normal; font-size: 14px; font-family: Verdana, Helvetica, Arial } td { color: #000000; font-size: 14px; font-family: Verdana, Helvetica, Arial } tr { color: #000000; font-size: 14px; font-family: Verdana, Helvetica, Arial } -a:link { color: #000000; text-decoration: none; font-size: 14px; font-family: Verdana, Helvetica, Arial } } -a:visited { color: #000000; text-decoration: none; font-size: 14px; font-family: Verdana, Helvetica, Arial } } -a:hover { color: #000000; text-decoration: underline; font-size: 14px; font-family: Verdana, Helvetica, Arial } } -a:active { color: #000000; text-decoration: none; font-size: 14px; font-family: Verdana, Helvetica, Arial } } +a:link { color: #000000; text-decoration: none; font-size: 14px; font-family: Verdana, Helvetica, Arial } +a:visited { color: #000000; text-decoration: none; font-size: 14px; font-family: Verdana, Helvetica, Arial } +a:hover { color: #000000; text-decoration: underline; font-size: 14px; font-family: Verdana, Helvetica, Arial } +a:active { color: #000000; text-decoration: none; font-size: 14px; font-family: Verdana, Helvetica, Arial } img { border-width: 0px } img { border: 0px } -div.instruction {text-align: left; font-size: 14px;} -div.serverhead {text-align: center; font-size: 14px;} -div.servermode {text-align: right; font-size: 14px;} +div.instruction { text-align: left; font-size: 14px } +div.serverhead { text-align: center; font-size: 14px } +div.servermode { text-align: right; font-size: 14px } +div.errmsg { text-align: center; font-size: 18px; color: #cc0000 } +div.cmdoutput { color: black; font-weight: normal; font-size: 14px; font-family: Courier, monospace } Index: systemcheck.php =================================================================== RCS file: /cvsroot/bobs/bobs/systemcheck.php,v retrieving revision 1.2 retrieving revision 1.3 diff -u -d -r1.2 -r1.3 --- systemcheck.php 26 Apr 2003 22:39:43 -0000 1.2 +++ systemcheck.php 1 May 2003 05:21:14 -0000 1.3 @@ -160,34 +160,6 @@ 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"); @@ -411,6 +383,7 @@ $srvtmpl->parse ('ROW', 'basictest'); $rtnval = submit(); + $srvtmpl->clear_dynamic ('basictest'); if ($rtnval[0] != -1){ $t->assign ('ITEM', "Testing communication with cmdloop process.<br> Process said: \"$rtnval[0]\""); @@ -422,7 +395,32 @@ $t->assign ('HELP', "Didn't get a valid response from cmdloop."); putfail(); } - $srvtmpl->clear_dynamic ('basictest'); + + // If backup has not been run on this server, + // the mount directory will not exist. + // Create it now so I can test if the mounts and stuff work. + + $mountdir=$srvcfg->get_mount_dir(); + if (! is_dir($mountdir)){ + $t->assign ('ITEM', "It appears $server/$share hasn't been backed up.<br> + I will attempt to create the mount directories needed to + continue these tests."); + $srvtmpl->assign ('MOUNTDIR', "$mountdir"); + $srvtmpl->parse ('ROW', 'crtmntdir'); + $rtnval = submit(); + $srvtmpl->clear_dynamic ('crtmntdir'); + $cmdoutput = getcmdout($rtnval); + if ($rtnval[0] == 0){ + $t->assign ('STATUS', 'PASS'); + putpass(); + } else { + $t->assign ('STATUS', 'FAIL'); + $t->assign ('HELP', "Unable to create mount directories. Message was:<br> + $cmdoutput"); + putfail(); + return(FALSE); // don't continue testing + } + } // Try to mount the selected share. @@ -444,7 +442,7 @@ $mounted=TRUE; } else { $t->assign ('STATUS', 'FAIL'); - $t->assign ('HELP', "Mount failed with this message:<br><pre> $cmdoutput </pre>"); + $t->assign ('HELP', "Mount failed with this message:<br>$cmdoutput"); putfail(); $mounted=FALSE; } @@ -466,12 +464,11 @@ } else { $t->assign ('STATUS', 'FAIL'); $t->assign ('HELP', "Write file test failed with these messages:<br> - <pre> $cmdoutput </pre>"); + $cmdoutput"); putfail(); } } - // Now unmount the share sleep(5); // Allow time for last operation to finish @@ -488,12 +485,33 @@ putpass(); } else { $t->assign ('STATUS', 'FAIL'); - $t->assign ('HELP', "Unmount failed with this message:<br><pre> $cmdoutput </pre>"); + $t->assign ('HELP', "Unmount failed with this message:<br>$cmdoutput"); putfail(); } } + // See if rsync works + + if ($method == "rsync"){ + $rsync = "rsync -n " . $server . '::' . $share; + $t->assign ('ITEM', "Using rsync to list files for backup method \"$method\" using this command:<br> + $rsync"); + $srvtmpl->assign ('COMMAND', "$rsync"); // the mount command + $srvtmpl->parse ('ROW', 'cmdwoutput'); + $rtnval = submit(); // submit the mount cmd + $srvtmpl->clear_dynamic ('cmdwoutput'); + $cmdoutput = getcmdout($rtnval); // Get the command's output + if ($rtnval[0] == 0) { + $t->assign ('STATUS', 'PASS'); + putpass(); + } else { + $t->assign ('STATUS', 'FAIL'); + $t->assign ('HELP', "Rsync failed with this message:<br>$cmdoutput"); + putfail(); + } + } + // Test mounting and unmounting the 'restore' method // and reading and writing a file. @@ -514,7 +532,7 @@ $mounted=TRUE; } else { $t->assign ('STATUS', 'FAIL'); - $t->assign ('HELP', "Mount failed with this message:<br><pre> $cmdoutput </pre>"); + $t->assign ('HELP', "Mount failed with this message:<br>$cmdoutput"); putfail(); $mounted=FALSE; } @@ -536,7 +554,7 @@ } else { $t->assign ('STATUS', 'FAIL'); $t->assign ('HELP', "Write file test failed with these messages:<br> - <pre> $cmdoutput </pre>"); + $cmdoutput"); putfail(); } } @@ -557,7 +575,7 @@ putpass(); } else { $t->assign ('STATUS', 'FAIL'); - $t->assign ('HELP', "Unmount failed with this message:<br><pre> $cmdoutput </pre>"); + $t->assign ('HELP', "Unmount failed with this message:<br>$cmdoutput"); putfail(); } @@ -569,14 +587,14 @@ $backupdir = $srvcfg->get_backupdir(); $srvbakdir = $backupdir . '/' . $server . '/' . $share; $t->assign ('ITEM', "Checking for completed backups in $srvbakdir."); - if ($dir = opendir("$srvbakdir")) { + if (is_dir($srvbakdir) && ($dir = opendir($srvbakdir))) { while (($file = readdir($dir)) && ($backups_exist == FALSE)) { - if (($file != ".") & ($file != "..")){ + if (($file != ".") && ($file != "..")){ $backups_exist = TRUE; } } + closedir($dir); } - closedir($dir); if ($backups_exist == TRUE) { $t->assign ('STATUS', 'PASS'); @@ -662,8 +680,9 @@ $cmdoutput = ""; foreach (array_slice($rtnval, 1) as $key => $value){ - $cmdoutput .= "$value"; + $cmdoutput .= nl2br("$value"); } + $cmdoutput = '<div class="cmdoutput">' . $cmdoutput . '</div>'; return $cmdoutput; } |