-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathupdateDocsNtbg.pl
More file actions
49 lines (47 loc) · 1.45 KB
/
updateDocsNtbg.pl
File metadata and controls
49 lines (47 loc) · 1.45 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
#!/usr/bin/perl -w
$docsFile = "/dbdocs/docs.txt";
$logFile = "/var/adm/syslog.dated/current/updateDocsNtbg.log";
if (-f $docsFile)
{
unlink($docsFile);
$state = $?;
if($state > 0)
{
print "CRITICAL - Could not remove $docsFile\n";
exit ($state / 256);
}
}
if ( -f "/usr/local/scripts/list_msm_dbdocs_nt.sh" )
{
system("su - orafm -c \"/usr/local/scripts/list_msm_dbdocs_nt.sh\" | tee $docsFile $logFile 2>>$logFile >/dev/null");
$status = $?;
if ( $status > 0)
{
open(FH, $logFile) or die "$!\n";
while(<FH>){print;}
print "UNKNOWN - the above are unknown errors";
exit 3;
}
open(my $fh, '<', $docsFile) or die "CRITICAL - Could not read file $docsFile $!";
my @lines = <$fh>;
close($fh);
shift @lines;
open($fh, '>', $docsFile) or die "CRITICAL - Could not write to file $docsFile $!";
print $fh @lines;
close($fh);
$status = system("scp -p /dbdocs/docs.txt ntpzone1:/siren_nfs");
if ($status == 0)
{
print "OK - $docsFile has created copied successfuly";
exit 0;
}
else
{
print "CRITICAL - $docsFile was not nor copied to ntpzone1\n";
}
}
else
{
print "WARNING - file list_msm_dbdocs_nt.sh is missing can't continue";
exit 1;
}