<div>I've been converting a LOT of our reports from paper to PDF/Copy to Windows FileServer.</div>
<div> </div>
<div>The below script runs great for us to copy .PDF / .XLS files created by (SCO 6) filepro for normal level users.</div>
<div>My problem is .. If root attempts to run a report & copy the .PDF to the FileServer, it crashs on the</div>
<div>system ( $command ) line. No output, no nothing.</div>
<div> </div>
<div>Anyone have any idea what might cause the script to crash out ?</div>
<div> </div>
<div>Software Rev's</div>
<div> sco 5v6.0.0</div>
<div> filepro 5.6.06K7D4</div>
<div> perl 5.8.7 (i586-pc-sysv5)</div>
<div> </div>
<div>Thanks in Advances</div>
<div> </div>
<div>Doug</div>
<div> </div>
<div>- Filepro Code -</div>
<div> ( pn { fn is /appl/fpmerge/excellist2 )</div>
<div>212 ------- - - - - - - - - - - - - - - - -<br> If: <br> Then: xx="/appl/scripts/scpreport" < pn { fn {".pdf HRR" <br>
213 ------- - - - - - - - - - - - - - - - -<br> If: <br> Then: xy = system( xx ) </div>
<div> </div>
<div>- script ( /appl/scripts/scpreport ) -</div>
<div> </div>
<div>
<p class="MsoNormal" style="MARGIN: 0in 0in 0pt"><font face="Times New Roman"><font color="#009900"><strong>#! /bin/perl</strong></font></font></p>
<p class="MsoNormal" style="MARGIN: 0in 0in 0pt"><font face="Times New Roman"><font color="#009900"><strong>use File::HomeDir;</strong></font></font></p>
<p class="MsoNormal" style="MARGIN: 0in 0in 0pt"><font face="Times New Roman" color="#009900"><strong> </strong></font></p>
<p class="MsoNormal" style="MARGIN: 0in 0in 0pt"><font face="Times New Roman"><font color="#009900"><strong>$ENV{PATH} = "/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/gnu/bin";</strong></font></font></p>
<p class="MsoNormal" style="MARGIN: 0in 0in 0pt"><font face="Times New Roman"><font color="#009900"><strong>$< = $>;<span style="mso-spacerun: yes"> </span># Real UID = Effective UID</strong></font></font></p>
<p class="MsoNormal" style="MARGIN: 0in 0in 0pt"><font face="Times New Roman" color="#009900"><strong> </strong></font></p>
<p class="MsoNormal" style="MARGIN: 0in 0in 0pt"><font face="Times New Roman"><font color="#009900"><strong>unless( $#ARGV + 1 == 2 ) {</strong></font></font></p>
<p class="MsoNormal" style="MARGIN: 0in 0in 0pt"><font face="Times New Roman"><font color="#009900"><strong><span style="mso-spacerun: yes"> </span>print "Incorrect number of arguments.\n";</strong></font></font></p>
<p class="MsoNormal" style="MARGIN: 0in 0in 0pt"><font face="Times New Roman"><font color="#009900"><strong><span style="mso-spacerun: yes"> </span>print "Usage:\n";</strong></font></font></p>
<p class="MsoNormal" style="MARGIN: 0in 0in 0pt"><font face="Times New Roman"><font color="#009900"><strong><span style="mso-spacerun: yes"> </span>die<span style="mso-spacerun: yes"> </span>"<span style="mso-spacerun: yes"> </span>scpreport source destination\n";</strong></font></font></p>
<p class="MsoNormal" style="MARGIN: 0in 0in 0pt"><font face="Times New Roman" color="#009900"><strong>}</strong></font></p>
<p class="MsoNormal" style="MARGIN: 0in 0in 0pt"><font face="Times New Roman"><font color="#009900"><strong>$dst_file = $ARGV[1];</strong></font></font></p>
<p class="MsoNormal" style="MARGIN: 0in 0in 0pt"><font face="Times New Roman" color="#009900"><strong> </strong></font></p>
<p class="MsoNormal" style="MARGIN: 0in 0in 0pt"><font face="Times New Roman"><font color="#009900"><strong>if ($src_file =~ /^([-\/\@\w.]+)$/) {</strong></font></font></p>
<p class="MsoNormal" style="MARGIN: 0in 0in 0pt"><font face="Times New Roman"><font color="#009900"><strong><span style="mso-spacerun: yes"> </span>$src_file = $1;</strong></font></font></p>
<p class="MsoNormal" style="MARGIN: 0in 0in 0pt"><font face="Times New Roman"><font color="#009900"><strong><span style="mso-spacerun: yes"> </span>} else {</strong></font></font></p>
<p class="MsoNormal" style="MARGIN: 0in 0in 0pt"><font face="Times New Roman"><font color="#009900"><strong><span style="mso-spacerun: yes"> </span>die "Bad Data in Source : $src_file";</strong></font></font></p>
<p class="MsoNormal" style="MARGIN: 0in 0in 0pt"><font face="Times New Roman"><font color="#009900"><strong><span style="mso-spacerun: yes"> </span>}</strong></font></font></p>
<p class="MsoNormal" style="MARGIN: 0in 0in 0pt"><font face="Times New Roman" color="#009900"><strong> </strong></font></p>
<p class="MsoNormal" style="MARGIN: 0in 0in 0pt"><font face="Times New Roman"><font color="#009900"><strong>if ($dst_file =~ /^([-\/\@\w.]+)$/) {</strong></font></font></p>
<p class="MsoNormal" style="MARGIN: 0in 0in 0pt"><font face="Times New Roman"><font color="#009900"><strong><span style="mso-spacerun: yes"> </span>$dst_file = $1;</strong></font></font></p>
<p class="MsoNormal" style="MARGIN: 0in 0in 0pt"><font face="Times New Roman"><font color="#009900"><strong><span style="mso-spacerun: yes"> </span>} else {</strong></font></font></p>
<p class="MsoNormal" style="MARGIN: 0in 0in 0pt"><font face="Times New Roman"><font color="#009900"><strong><span style="mso-spacerun: yes"> </span>die "Bad Data in Destination: $dst_file";</strong></font></font></p>
<p class="MsoNormal" style="MARGIN: 0in 0in 0pt"><font face="Times New Roman"><font color="#009900"><strong><span style="mso-spacerun: yes"> </span>}</strong></font></font></p>
<p class="MsoNormal" style="MARGIN: 0in 0in 0pt"><font face="Times New Roman" color="#009900"><strong> </strong></font></p>
<p class="MsoNormal" style="MARGIN: 0in 0in 0pt"><font face="Times New Roman"><font color="#009900"><strong>$identity = home( 'filepro' ) . "/.ssh/id_rsa";</strong></font></font></p>
<p class="MsoNormal" style="MARGIN: 0in 0in 0pt"><font face="Times New Roman"><font color="#009900"><strong>$command = "/bin/scp " .</strong></font></font></p>
<p class="MsoNormal" style="MARGIN: 0in 0in 0pt"><font face="Times New Roman"><font color="#009900"><strong><span style="mso-spacerun: yes"> </span>"-q </strong></font></font><font face="Times New Roman"><font color="#009900"><strong>-i $identity </strong></font></font><font face="Times New Roman"><font color="#009900"><strong>$src_file filepro\@FileServer01:/public/$dst_file " ;</strong></font></font></p>
<p class="MsoNormal" style="MARGIN: 0in 0in 0pt"><font face="Times New Roman" color="#009900"><strong> </strong></font></p>
<p class="MsoNormal" style="MARGIN: 0in 0in 0pt"><font face="Times New Roman"><font color="#009900"><strong>if( system( $command ) ) {</strong></font></font></p>
<p class="MsoNormal" style="MARGIN: 0in 0in 0pt"><font face="Times New Roman"><font color="#009900"><strong><span style="mso-spacerun: yes"> </span>print "<span style="mso-spacerun: yes"> </span>FAILED!!!\n";</strong></font></font></p>
<p class="MsoNormal" style="MARGIN: 0in 0in 0pt"><font face="Times New Roman"><font color="#009900"><strong><span style="mso-spacerun: yes"> </span>die "unable to execute $command\n";</strong></font></font></p>
<p class="MsoNormal" style="MARGIN: 0in 0in 0pt"><font face="Times New Roman"><font color="#009900"><strong>} else {</strong></font></font></p>
<p class="MsoNormal" style="MARGIN: 0in 0in 0pt"><font face="Times New Roman"><font color="#009900"><strong><span style="mso-spacerun: yes"> </span>print "<span style="mso-spacerun: yes"> </span>Done\n";</strong></font></font></p>
<p class="MsoNormal" style="MARGIN: 0in 0in 0pt"><font face="Times New Roman" color="#009900"><strong>}</strong></font></p>
<p class="MsoNormal" style="MARGIN: 0in 0in 0pt"><strong><font face="Times New Roman" color="#009900"></font></strong> </p></div>