aschearer (owner)

Fork Of

gist: 206599 by anonymous

Revisions

  • c7bc1f Fri Oct 09 21:37:54 -0700 2009
gist: 206601 Download_button fork
public
Public Clone URL: git://gist.github.com/206601.git
Embed All Files: show embed
Perl #
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
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
#!/usr/bin/perl
# file: perltest.pl
 
print "\n";
##################################################
#SET VARIABLES
##################################################
#print "Which script do you want to run? \n all, 1 (SessionExtract), 2 (MMX v. CMX), 3 (DictionaryIntegrity) \n";
 
 
 
#set filepaths
$blatcall = 'C:/blat/blat262/full/blat';
$scriptsloc = "//cswadc01/common/team_rich/clients/msn_extract/qa_files/templates_and_macros/qa_scripts/";
$isql = '"C:/Program Files/Sybase/ASIQ-12_6/win32/dbisql" -datasource csiadpwr11 -nogui ';
$destfolder = "c:/testfiles/";
#$destfolder = "//cswadc01/common/team_rich/clients/msn_extract/qa_files/qa_checks_files/";
 
#set email variables
$body = 'Test successful';
$toemail = 'jforan@comscore.com';
$fromemail = 'jforan@comscore.com';
$subject = 'Subject line';
 
#print confirmation
print "Variables set. \n\n";
 
##################################################
#CALL QA SCRIPTS
##################################################
if ($a == 1)
{
print "Begin running all scripts. " . scalar localtime() . "\n";
 
##run all
#my $rc = system($isql . $scriptsloc . 'MONTHLY_QA_MAIN.sql > ' . $destfolder . 'monthly_qa_output.txt');
 
} else {
use Switch;
switch ($sqlfile) {
case 1 {
print "Running SessionExtractQA.sql \n";
my $rc = system($isql . $scriptsloc . 'SessionLevelQA.sql > ' . $destfolder . 'sessionqa_output.txt');
}
case 2 {
print "Running CMX_MMX_Trending.sql \n";
my $rc = system($isql . $scriptsloc . 'MMX_CMX_Trending.sql > ' . $destfolder . 'sessionqa_output.txt');
       }
case 3 {
print "Running Dictionary_Integrity.sql \n";
my $rc = system($isql . $scriptsloc . 'test.sql > ' . $destfolder . 'sessionqa_output.txt');
}
else {
print "!!Invalid script input. Exiting now. \n";
exit;
}
}
my $rc = system($isql . $sqlfile . ' > ' . $destfolder . 'output.txt');
}
if ($rc == 0) {
#print confirmation
print "\nScript run successful. \n\n";
} else {
print "\n!!Error running script. Exiting now. \n";
exit;
}
 
 
##################################################
#SEND EMAIL NOTIFICATIONS
##################################################
 
if ($rc == 0) {
$msg = ' -body "' . $body . '" -to ' . $toemail . ' -f ' . $fromemail . ' -s "' . $subject . '" -server smtp.office.comscore.com';
}
 
if ($e == 1) {
my $rc = system($blatcall . $msg);
 
if ($rc == 0)
{
print "Email sent successfully. \n\n";
}
else
{
print "!!Email error. Successful script completion though. \n\n";
}
} else {
print "No email sent, but successful script completion. \n\n";
}
 
print "\n";