?? exportcrr
字號:
## OpenCA - RA Server Command## (c) 1998-2001 by Massimiliano Pala and OpenCA Group#### File Name: exportReqs## Brief: Export Approved Requests## Description: Exports to removable media Approved Requests waiting## to be approved by the CA## Parameters: if ( $cmd !~ /exportCRR/i ) { configError( "Wrong Command Usage ($cmd over exportCRR)!" ); exit 1;}## GNU Tar suggested for exporting Certification Request## to the CA. We use the GNU tar because of its availability## for all the platforms and its stability.my $tmpdir = getRequired( 'TempDir' );print $query->start_html(-title=>"Requests Exporting Page", -BGCOLOR=>"#FFFFFF");## Get required parameters from the configuration filemy $cmd = getRequired( 'CreateArchive' );my $test = getRequired( 'TestArchive' );my $dev = getRequired( 'ExportDev' );my $bak = getRequired( 'ExportBackup' );my $dir = "$tmpdir/${$}_exp.dir";## my $curDir = cwd();umask( 0077 );mkdir ( "$dir", 0700 );if( $? != 0 ) { configError( "Error while creating temp exporting dir ($dir)!");};my @reqList = $db->searchItems( DATATYPE=>"APPROVED_CRR" );foreach $req (@reqList) { my $key = $req->getParsed->{DBKEY}; my $fileName = "${dir}/${key}.req"; open( FD, ">$fileName" ) or die ("Cannot write to $fileName!"); print FD $req->{crr}; close( FD );}## Subtitute $orig and $dest$cmd = $query->subVar( $cmd, '$dest', $dev );$test = $query->subVar( $test, '$dest', $dev );print startLogPage("Approved Certificate Revocation Requests Exporting");print addLogSection("Requests Exporting .... ");if( not chdir( "$dir" )) { print addErrorLog( "Failed changing dir to $dir." ); closePage(); exit 1;} $ret = `$cmd . 2>&1`;if( $? != 0 ) { print addErrorLog( "Archiving Failed on $dev!", "$ret" ); closePage(); exit;} print addLogLine( "Ok." );print addPreLogLine( $ret );print closeLogSection();print addLogSection("Testing Created Archive ... ");$ret = `$test 2>&1`;if( $? != 0 ) { print addErrorLog( "Check Failed on $dev!" ); closePage(); exit;}print addLogLine( "Ok." );print addPreLogLine( $ret );print closeLogSection();print addLogSection("Deleting temporary files .... ");$tools->deleteFiles( DIR=>$dir, FILTER=>"*.req" );print addLogLine("Ok.");print closeLogSection();print addLogSection("Removing temporary dir .... ");rmdir( "$dir" );if( $? != 0 ) { print addErrorLog( "Removing Failed!" ); closePage(); exit;}print addLogLine("Ok.");print closeLogSection();print addLogSection( "Archiving Exported Request(s) ... " );my @reqList = $db->searchItems( DATATYPE=>"APPROVED_CRR" );foreach $req (@reqList) { my $key = $req->getParsed->{DBKEY}; ## Store reqs in the archivied reqs dB if ( not $db->updateStatus( DATATYPE=>"APPROVED_CRR", NEWTYPE=>"ARCHIVIED_CRR", OBJECT=>$req)) { print addErrorLog("Error archiving request $key!"); closePage(); exit 1; }}print addLogLine("Ok.");print closeLogSection();closePage();1;
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -