I wrote script that edits data and then loads it into database. Under Unix environment it works but under linux(centos 4.6) load to database does not work.
#!/usr/bin/perl -w use POSIX qw(strftime); $in_dir = '/home/data'; $out_dir = '/var/www/html/rwa_test/input'; $zip_dir = '/home/data/archive'; $kpva = strftime("%Y%m%d", localtime); $wait = 30; while (0 < 1) { system ("ls -htr $in_dir/*.P.M > $in_dir/failid.rwa "); sleep 30; open(TF, "$in_dir/failid.rwa"); while (<TF>) { chomp; print $_,"\n"; s|$in_dir/||; print $_,"\n"; $ifn = $_; system("gzip -f <$in_dir/$ifn >$zip_dir/$ifn.$kpva.gz" +); open(IF,"$in_dir/$ifn"); open(OF,">$out_dir/$ifn.$kpva"); while(<IF>) { chomp; $line = $_; last if $line =~ /^-{19}/; $line =~ s/,/./g; $line =~ s/\t/;/g; print OF $line,"\n"; } close (IF); close (OF); $cmd = "dbisqlc -c ".'"uid=.....;pwd=.....;eng=......;dbn=...... "'." +-q call ......Fun_LoadAllFiles( '"."$out_dir/$ifn.$kpva', '$ifn.$kpva +')"; print $cmd,"\n"; system (@cmd); system("mv -f $in_dir/$ifn $in_dir/$ifn.done"); } close(TF); sleep $wait; }
why does this part not under linux work?
$cmd = "dbisqlc -c ".'"uid=****;pwd=****;eng=****;dbn=**** "'." -q cal +l ****.Fun_LoadAllFiles( '"."$out_dir/$ifn.$kpva', '$ifn.$kpva')";
added print $cmd and it shows as it should <code> dbisqlc -c "uid=****;pwd=*****;eng=*****;dbn=***** " -q call ****.Fun_LoadAllFiles( '/var/www/html/rwa_test/input/file_name', 'file_name')

In reply to unable execute $cmd by tannx

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.