From: Joe Z. <jz...@us...> - 2003-04-26 22:39:46
|
Update of /cvsroot/bobs/bobs/inc In directory sc8-pr-cvs1:/tmp/cvs-serv7450/bobs/inc Modified Files: class_server.php header.pinc Log Message: Add server specific configuration checks to systemcheck.php. Index: class_server.php =================================================================== RCS file: /cvsroot/bobs/bobs/inc/class_server.php,v retrieving revision 1.2 retrieving revision 1.3 diff -u -d -r1.2 -r1.3 --- class_server.php 7 Sep 2002 20:31:22 -0000 1.2 +++ class_server.php 26 Apr 2003 22:39:43 -0000 1.3 @@ -9,7 +9,7 @@ var $servers = ''; // store for configurations // server ini files are parsed and // stored in $servers[] array - var $config = ''; // config to pass to other classes witha single server configuration, + var $config = ''; // config to pass to other classes with a single server configuration, // also used as a general data store. // $config should be replaced with class functions, // but it's pretty ingrained right now. @@ -192,6 +192,93 @@ } return; +} + +// --------------------------------------------------------- +// get_mount_cmd - Build the 'mount' command +// Used by: systemcheck.php. Should be used by others later. +// Parms: $bkprst: 'backup' - build mount cmd for backup +// 'restore' - build mount cmd for restore +// Returns: The command string to mount the current share +// Note: set_config() should have been previously called. +// --------------------------------------------------------- +function get_mount_cmd($bkprst){ + + switch ($bkprst){ + case 'backup': $method = $this->config['backup_method']; + break; + case 'restore': $method = $this->config['restore_method']; + break; + default: return FALSE; + } + + $mountdir = $this->get_mount_dir(); + + // Server name or ip? + if ( $this->server_ip == '' ) { + $server_handle = $this->config['server']; + } else { + $server_handle = $this->config['serverip']; + } + + switch ($method){ + case 'rsync': $mntcmd = ""; // rsync needs no mount cmd + break; + case 'smb': $mntcmd = 'smbmount "//' . $server_handle . '/' . $this->config['smb_share'] . + '" "' . $mountdir . '" -o username=' . + $this->config['login'] . ',password=' . $this->config['password']; + break; + case 'nfs': $mntcmd = 'mount -t nfs ' . '"' . $server_handle . ':' . + $this->config['nfs_share'] . '" "' . $mountdir . '"'; + break; + default: $mntcmd = FALSE; + } + return $mntcmd; +} + +// --------------------------------------------------------- +// get_umount_cmd - Build the 'umount' command +// Used by: systemcheck.php. Should be used by others later. +// Parms: $bkprst: 'backup' - build mount cmd for backup +// 'restore' - build mount cmd for restore +// Returns: The command string to unmount the current share +// Note: set_config() should have been previously called. +// --------------------------------------------------------- +function get_umount_cmd($bkprst){ + + switch ($bkprst){ + case 'backup': $method = $this->config['backup_method']; + break; + case 'restore': $method = $this->config['restore_method']; + break; + default: return FALSE; + } + + $mountdir = $this->get_mount_dir(); + + switch ($method){ + case 'rsync': $umntcmd = ""; // rsync needs no mount cmd + break; + case 'smb': $umntcmd = 'umount "' . $mountdir . '"'; + break; + case 'nfs': $umntcmd = 'umount "' . $mountdir . '"'; + break; + default: $umntcmd = FALSE; + } + return $umntcmd; +} + +// --------------------------------------------------------- +// get_mount_dir - Return the mount directory path +// Used by: systemcheck.php and $this +// Parms: none +// Returns: string - the mount directory path +// Note: set_config() should have been previously called. +// --------------------------------------------------------- +function get_mount_dir(){ + $mountdir = $this->sys_conf['backupdir'] . '/process/mounts/' . + $this->config['server'] . '/' . $this->config['share']; + return $mountdir; } // --------------------------------------------------------- Index: header.pinc =================================================================== RCS file: /cvsroot/bobs/bobs/inc/header.pinc,v retrieving revision 1.5 retrieving revision 1.6 diff -u -d -r1.5 -r1.6 --- header.pinc 24 Apr 2003 06:15:59 -0000 1.5 +++ header.pinc 26 Apr 2003 22:39:43 -0000 1.6 @@ -1,7 +1,7 @@ <html> <head> <title>BOBS Administration</title> -<link rel="STYLESHEET" href="look.css" type="text/css"> +<link rel="STYLESHEET" href="lookadmin.css" type="text/css"> </head> <body> |