Changeset 35485
- Timestamp:
- May 2, 2013, 11:49:21 AM (13 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
tags/ipp-20130307/pstamp/scripts/pstamp_webrequest.pl
r29383 r35485 5 5 # 6 6 # The arguments are the command line parameters for the program psmkreq 7 #8 # Unless the argument -list is provided the output is the request id for the resulting request9 #10 # If -list is the first argument, the request file is built and parsed and the11 # the selected "input" uris are listed on stdout.12 7 # 13 8 # Note: Despite the name there nothing particularly web specific about this program. … … 23 18 24 19 my $host = hostname(); 25 my $verbose = 1;20 my $verbose = 0; 26 21 my $dbname; 27 22 my $dbserver; 23 my $pretend; 24 my $label = 'WEB'; 25 my $req_name_prefix = 'web'; 26 my $username; 28 27 29 28 GetOptions( 30 29 'dbname=s' => \$dbname, 31 30 'dbserver=s' => \$dbserver, 32 'verbose' => \$verbose, 31 'label=s' => \$label, 32 'username=s' => \$username, 33 'prefix=s' => \$req_name_prefix, 34 'pretend' => \$pretend, 35 'verbose' => \$verbose, 33 36 ); 34 37 … … 36 39 37 40 if ($verbose) { 38 print "\n\n";39 print "Starting script $0 on $host\n\n";41 print STDERR "\n\n"; 42 print STDERR "Starting script $0 on $host\n\n"; 40 43 } 41 44 … … 70 73 # make a request file 71 74 my $cur_dir = getcwd(); 75 72 76 #print STDERR "cur_dir is $cur_dir\n"; 73 77 74 my $datestr = strftime "%Y %m%d", gmtime;78 my $datestr = strftime "%Y/%m/%d", gmtime; 75 79 my $datedir = "$cur_dir/webreq/$datestr"; 76 80 if (! -e $datedir ) { 77 if (! mkdir $datedir ) { 78 print STDERR "failed to create working directory $datedir"; 81 my $rc = system "mkdir -p $datedir"; 82 if ($rc) { 83 my $status = $rc >> 8; 84 print STDERR "failed to create working directory $datedir: $rc $status"; 79 85 exit $PS_EXIT_CONFIG_ERROR; 80 86 } 81 87 } 82 88 83 my $request_name = "web_". get_webreq_num();89 my $request_name = $req_name_prefix . '_' . get_webreq_num(); 84 90 my $request_file = "$datedir/$request_name.fits"; 85 91 { … … 96 102 # Queue the request 97 103 my $req_id = 0; 98 {104 unless ($pretend) { 99 105 100 106 my $command = "$pstamptool -addreq -uri $request_file -ds_id 0"; 101 $command .= " -label WEB"; 107 $command .= " -label $label"; 108 $command .= " -username $username" if $username; 102 109 $command .= " -dbname $dbname" if $dbname; 103 110 $command .= " -dbserver $dbserver" if $dbserver; … … 109 116 } 110 117 $req_id = ${$stdout_buf}[0]; 118 chomp $req_id; 111 119 } 112 120
Note:
See TracChangeset
for help on using the changeset viewer.
