Login   Register  
PHP Classes
elePHPant
Icontem

File: Sample.php

Recommend this page to a friend!
Stumble It! Stumble It! Bookmark in del.icio.us Bookmark in del.icio.us
  Classes of Max Schmid  >  Cisco Config Copy  >  Sample.php  >  Download  
File: Sample.php
Role: Example script
Content type: text/plain
Description: Usage sample
Class: Cisco Config Copy
Backup Cisco router configuration using SNMP
Author: By
Last change:
Date: 2004-04-13 23:46
Size: 803 bytes
 

Contents

Class file image Download
<?PHP

require_once dirname(__FILE__).'/ConfigCopy.class.php';


$timeout 60;
$community "RWcommunity";
$tftphost "192.168.1.254";
$dirname "config-backup/".time()."/";

echo 
$dirname,"\n";

/* Create backup Directory */
mkdir("/tftpboot/".$dirname0777); // Directory MUST be rwx for all users
chmod("/tftpboot/".$dirname0777); // Directory MUST be rwx for all users


/* Create host list */

$device = array (=> "192.168.1.1"=> "192.168.1.2"=> "192.168.1.3");

/* Process each host */

$CC = new CiscoConfigCopy();

$cnt_row count($device);
$cnt=0;
echo 
"Processing ",$cnt_row," devices....\n\n";

while(
$cnt $cnt_row){
        
$CC->do_config_backup($device[$cnt], $community$timeout$tftphost$dirname$cnt+1);
        
$cnt++;
}


?>