curtisb has asked for the wisdom of the Perl Monks concerning the following question:
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
|
---|