All,

Once again I am back to my old tricks. I'm working on a database rebuild script that will shutdown the old database, create a new database file, start the old database as an engine only, then unload the old database and reload into the new database.

My problem is where I have noted. Once the old database is started it will not move to the next line of code until the database is stopped. So, my question is this:

How do I get the script to move to the next line of code? Is there something I'm missing when I use the "system" fucntion?

Any help would be greatly appreciated.

Thanks,

Bobby Curtis

#!/usr/bin/perl -w use strict; ######################### # # #DEFINE GLOBAL VARIABLES# # # ######################### #my @args = ("-c \"dsn=dba_fmds;uid=dba;pwd=sql\"","-ii","-t plan","D: +/workingfiles/scripts"); my @args0 = ("\/FI \"imagename eq dbsrv9.exe\""); my @stopargs = ("stop ASANYs_awrdsprodcution"); my @scqueryargs = ("query ASANYs_awrdsprodcution"); my @initargs = ("-p 8192","D:/WorkingFiles/DATABASES/CURRENTDATABASES/ +ARNET/TestBuild/"."arsams.db"); my @engstartargs = ("D:/WorkingFiles/DATABASES/CURRENTDATABASES/ARNET/ +arsams.db"); my $stopvalue = 0; ######################### # # #Function Script # # # ######################### if (system("tasklist",@args0) == 0 && system("sc @scqueryargs") == 0) { print "\n"; print "Stop service: "; my $std_in0 = <STDIN>; chomp($std_in0); if($std_in0 eq "y"){ system("sc @stopargs"); $stopvalue = 1; print "\n"; print "Stop value set to: $stopvalue\n"; print "\n"; if($stopvalue == 1) { print "Creating new database file with 8192 kilobyte page +file\n"; print "\n"; system("dbinit", @initargs); print "\nNew database file created\n"; print "Starting old database with dbeng9\n"; system("dbeng9", @engstartargs); #HANGS UNTIL DATABASE IS + SHUTDOWN....WHY???? print "Old database started with dbeng9\n"; $stopvalue = 0; } }else{ warn "Service will not be stopped\n"; } }else{ print "==>==>==> failure, exit status = $?\n"; }

Janitored by Arunbear - added readmore tags, as per Monastery guidelines


In reply to System Function...script does not move until process ends. by curtisb

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.