Beefy Boxes and Bandwidth Generously Provided by pair Networks
Welcome to the Monastery
 
PerlMonks  

comment on

( [id://3333]=superdoc: print w/replies, xml ) Need Help??
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":



  • Are you posting in the right place? Check out Where do I post X? to know for sure.
  • Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
    <code> <a> <b> <big> <blockquote> <br /> <dd> <dl> <dt> <em> <font> <h1> <h2> <h3> <h4> <h5> <h6> <hr /> <i> <li> <nbsp> <ol> <p> <small> <strike> <strong> <sub> <sup> <table> <td> <th> <tr> <tt> <u> <ul>
  • Snippets of code should be wrapped in <code> tags not <pre> tags. In fact, <pre> tags should generally be avoided. If they must be used, extreme care should be taken to ensure that their contents do not have long lines (<70 chars), in order to prevent horizontal scrolling (and possible janitor intervention).
  • Want more info? How to link or How to display code and escape characters are good places to start.
Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others imbibing at the Monastery: (4)
As of 2024-03-29 00:49 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found