Script to wait for Clone task is completed

Good day, as part of the post, I run a command that enables the NIC and sets the right Port-Group of cloning process. I put a sleep command in each environment is diferrent, so I find myself always change this duration of sleep because the cloning process does not end in the time of sleep and the rest of the script fails. So in order to get rid of the sleep control that I want to capture the CloneVM_Task and pass this parameter to wait-task that will force the completion of the ClonVM_Task. I could just make sure no other tasks are running but this task, but as we all know that alays can't be the case. So that's what I did.

I begin a deployment of FVO to have an another long running task. Then I run the script.

If ((Get - PSSnapin - name Vmware.VimAutomation.Core - ErrorAction SilentlyContinue) - eq $null) {Add-PSSnapin "Vmware.VimAutomation.Core"}

# Virtual Center details
$server_address = "MYvCenter name" or IP

SE connect-VIServer-Server $server_Address - user username-pass password - WarningAction SilentlyContinue


#Create Master VM Templates
#
# Here we import the CSV file with the account information and he piped in a Foreach-object
# Creating a Variable that imports the csv file that contains all data of the virtual machine

CD "e:\Scripts.
$InputFile = import-Csv "E:\scripts\mycloneinput.csv".
$InputFile | {ForEach-Object

$ip = $_. VM_IPAddress
$GName = $_. VM_Guestname
$TName = $_. Template_name
$HName = get-VMHost "myhostname" # 1 first Select
$Desc = $_. Description
$Dstore = $_. Datastore_Name
$Spec = $_. Customization
$Folder = $_. Folder
$Sfolder = $_. Subfolder
$NIC = $_. NIC
$NIC_Lable = $_. NIC_Label
$Gateway = $_. NIC_Gateway
$SubnetMask = "255.255.255.0".
$DNS1 = $_. DNS1
$DNS2 = $_. DNS2

Write-host "creation: ' $GName
Write-host "template name is: ' $TName

# This takes variables and creates the virtual machine
Get-OSCustomizationSpec $Spec | Get-OSCustomizationNicMapping | »
Game-OSCustomizationNicMapping - IpMode UseStaticIP - $ip - $SubnetMask subnet mask - DNS IpAddress $DNS1, $DNS2 - DefaultGateway $Gateway
New-VM-name $GName - location $Folder - model $TName - host $HName - $Dstore - $Desc Description data store - OSCustomizationSpec $Spec - RunAsync-confirm: $false

#######################################
#Waiting for cloning process to finish.
#######################################

$$$ Under notes show a little history of how I got to this point.

$$ Note1: the first attempt, I just captured running tasks and their past to the task pending. "Well, since the deploy OVF and ClonVM_Task where it runs would wait up to two when completed by the end."

$$ Note2: so I added the If Else loop below that failed, because $RTask never equaled only CloneVM_Task, but was a table of two.

$$ Note3: I tried to us below to separate the two tasks to help

# $RTask = get-task-status running (who captured the two tasks running)

# $Array = $Rtask.Split("") (Errored with the method call failed because [System.Object []] contains a method named 'Split'.)
# So I tried to divide the table like this. ForEach ($Task in $Rtask.Name - Split("")) {Write-Host "my tasks are:" $Task}


Get-task-status Running | Export-CSV "E:\scripts\Current_Tasks.csv".
$InputFile2 = import-CSV "E:\scripts\mmca\mmca_Current_Tasks.csv".
$InputFile2 | {ForEach-Object
$RTask = $_. Name
Write-Host "current task is: ' $RTask
IF ($RTask - eq "CloneVM_Task") {}
Write-Host "current task of Clonning is: ' $RTask
Write-Host "in the meantime the cloning process finish.
Waiting-task-task $MyTask
}
Else {}
Write-Host "no cloning process is executed.
}
}

# This allows the NIC and set the correct Port Group
Get-VM-name $GName | Get-NetworkAdapter-name $NIC | Together-NetworkAdapter - NetworkName $NIC_Lable-confirm: $false - StartConnected $true

}

When I run the present, I get the following:

# #This shows the task start Clonning #.

erverId: /[email protected]:443 /
Status: running
IsCancelable: true
PercentComplete: 5
StartTime: 03/05/2013 00:52:13
FinishTime:
ObjectId: VirtualMachine-vm-382
Result:
Description: Clone virtual machine
ExtensionData: VMware.Vim.Task
ID: Work-task-2070
Name: CloneVM_Task
UID: /[email protected]:443 / task = work-work-2070 /

#########################################################

# #Runs through the tasks running.

Current task: deploy the model to the FVO
No cloning process is executed

# Ignore deploy it task #.

# #Matches the If statement and continues to process #.
Current task is: CloneVM_Task
Task current Clonning is: CloneVM_Task
Wait for the cloning process to complete

# #Error #.

Waiting-Task: cannot bind parameter 'task '. Impossible to convert the value of 'CloneVM_Task' to type 'System.String' type 'VMware.VimAutomation.Sdk.Types.V1.Task '.
E:\scripts\Working_Create_Master_Templates.ps1:71 tank: 24
+ Wait-task-task < < < < $RTask
+ CategoryInfo: InvalidArgument: (:)) [waiting-Task], ParameterBindingException)
+ FullyQualifiedErrorId: CannotConvertArgumentNoMessage, VMware.VimAutomation.ViCore.Cmdlets.Commands.WaitTask

$$$ Under notes show a little history of how I got to this point.

Note1: The first attempt, I have just captured tasks currently running and pending their past to the task. "Well, since the deploy OVF and ClonVM_Task where it runs would wait up to two when completed by the end."

NOTE2: So I added the If Else loop below which failed because $RTask never equaled only CloneVM_Task, but was a picture of two tasks.

Note3: I tried to use the following to divide the two tasks:

$RTask = get-task-status running (who captured the two tasks running)

foreach ($Task in $Rtask - Split(""))
{
{Write-Host "my tasks are:" $Task}
IF ($Task - eq "CloneVM_Task") {}
Write-Host "current task of Clonning is: ' $Task
Write-Host "in the meantime the cloning process finish.
Waiting-task-task $Task
}
Else {}
Write-Host "no cloning process is executed.
}


}

# #Output the little script above #.

Current task: deploy OVF model CloneVM_Task
My tasks are: deploy
My tasks are: OVF
My tasks are: model
My tasks are: CloneVM_Task
Task current Clonning is: CloneVM_Task
Wait for the cloning process to complete
Waiting-Task: cannot bind parameter 'task '. Impossible to convert the value of 'CloneVM_Task' to type 'System.String' type 'VMware.VimAutomation.Sdk.Types.V1.Task '.
Online: 11 char: 24
+ Wait-task-task < < < < $Task
+ CategoryInfo: InvalidArgument: (:)) [waiting-Task], ParameterBindingException)
+ FullyQualifiedErrorId: CannotConvertArgumentNoMessage, VMware.VimAutomation.ViCore.Cmdlets.Commands.WaitTask

I'm new to Powercli and I've scoured Google for a possible answer. I thought I might have a solution that has been published on the VMware PowerCLI Forum, but I couldn't get this to work. Any help would be greatly appreciated.

#########################################

I wasn't worried about how to tasks where splits, unless I was trying to follow the import fo the OVF, so that the script went into the loop If and as one of the names for CloneVM_Task then he Treaty. But I got the same error I did in the last version of the above script. That's why I have the version curent thinking that if I exported and then imported the tasks it might make a difference.

I'm new to Powercli and would like a little help. I am either very close or by a mile off. :-)

Thank you

Mitch

Why don't you store the the task object that is returned when you use the RunAsync switch?

You can create a loop around the State and wait until the clone job is done.

$task = New-VM -Name MyVM ... -RunAsync 

while($task.ExtensionData.Info.State -eq "running"){
  sleep 1  $task.ExtensionData.UpdateViewData('Info.State')
}

The big difference with the Wait-job cmdlet, it is that this will allow you to perform additional work in the While loop.

Waiting-task the cmdlet waits just until the task is finisned and you can not do anything else.

Tags: VMware

Similar Questions

  • waiting for a task to complete

    During the planning of a work like this:

    () dbms_scheduler.create_job
    job_name = > a_prog_name | "_JOB."
    job_type = > 'executable. "
    job_action = > a_local_dir | '\' || File1 | ' > null',.
    enabled = > true,
    auto_drop = > true
    );


    Is it possible to wait for the work to be done before treatment can continue?

    Thank you
    Thomas

    Hello

    You can do this by leaving enabled-false online during the creation of employment and then by doing a run_job on the job. The run_job (with use_current_session-online true) will execute the task and wait for it to finish. If you do this, you will also need to manually deposit work using drop_job.

    Hope this helps,
    Ravi.

  • waiting for the task to be completed

    I inherited a program that tests a hardware device extensively.  A test turns or several times each channel of AI and bed the waveform of channel I.  I use a card PXI-6229 DAQ with c# .NET.  The program is suspended in the while loop, wait until the task is complete. This is the code:

    public bool TestThisChannel (object nullObject) {}
    Double coversionFactor;
    String name;
    String Description;
    _PXI6229_SLOT12.getChannelInfo ((int) nullObject, name, coversionFactor, to the Description);
    _PXI6229_SLOT12. StartAnalogInput6s (Name);
    for (int i = 0; i)< 5;="" i++)="" {="" 5="">
    _PXIChassis.SetPowerRelayOn (null);
    _PXIChassis.Wait500ms (null);
    _PXIChassis.SetPowerRelayOff (null);
    _PXIChassis.Wait500ms (null);
    }
               
    While {(_PXI6229_SLOT12.runningTask!=null)}
    } //Wait task is completed

    AnalogMultipleInputTask private task;
    runningTask of public work;
    private AsyncCallback analogCallback;
    Private AnalogMultiChannelReader analogInReader;
    public AnalogWaveformdata;

    Public Sub StartAnalogInput6s (string AIChannel)
    {
    Create a new task
    try {}
    AnalogMultipleInputTask = new Task();

    Create a virtual channel
    AnalogMultipleInputTask.AIChannels.CreateVoltageChannel (AIChannel, "",)
    (AITerminalConfiguration) (-1),-10, 10, AIVoltageUnits.Volts);

    Configure synchronization settings
                   
    AnalogMultipleInputTask.Timing.ConfigureSampleClock ("", 100000, SampleClockActiveEdge.Rising, SampleQuantityMode.ContinuousSamples, 600000);
                   
    Check the task
    AnalogMultipleInputTask.Control (TaskAction.Verify);

    Prepare the table for the data
    runningTask = AnalogMultipleInputTask;
    analogInReader = new AnalogMultiChannelReader (AnalogMultipleInputTask.Stream);
    analogCallback = new AsyncCallback (EndAnalogInput);

    For .NET Framework 2.0 or a later version, use SynchronizeCallbacks to specify that the object
    Marshals the callbacks on the appropriate threads.
    analogInReader.SynchronizeCallbacks = true;
    analogInReader.BeginReadWaveform (600000, analogCallback, AnalogMultipleInputTask);
    } catch (Exception exception) {}
    MessageBox.Show (exception. (Message);
    runningTask = null;
    AnalogMultipleInputTask.Dispose ();
    }
    }

    public void EndAnalogInput (IAsyncResult ar)
    {
    Try
    {
    If (runningTask is ATR AsyncState)
    {
    Read the data of the channels
    data = analogInReader.EndReadWaveform (ar);
    }
    }
    catch (System.exception DaqException)
    {
    Display errors
    MessageBox.Show (exception. (Message);
    runningTask = null;

    AnalogMultipleInputTask.Dispose ();
    }
    }

    Any help will be appreciated.

    Thank you

    Howard

    Thanks Mason. You got me thinking on the right track.  I made a few changes based on an example I found of NOR.  I changed analogInReader.BeginReadWaveform (...) of data = analogInReader.ReadWaveform (600000) and I changed the while (_PXI6229_SLOT12.runningTask! = null) {} to _PXI6229_SLOT12.runningTask.WaitUntilDone () and it seems to work fine.

    Thanks for your help.

    Howard

  • wait for a task

    I'm cloning a VM and need to wait for the task to be completed in my perl script.

    I looked at the documentation for the SDK, (on the subject of the task and taskinfo) I don't see anything for this.

    If anyone has example of perl code that does this, it would be really appreciated.

    Suresh.

    Here's a little function that allows you to wait a task ends, she essentially loop until the State is success OR if it error. Remember, when you get to a task, you only have access to it for about 10 min, once that happened, even if you have the handle of taskRef, you cannot question him. You will need to use the tasks and the CreateCollectorForTasks Manager to collect the specific task and query its status and basically block until it is complete.

    
    my $task = ...
    my $success = "suceess!";
    
    &getStatus($task,$sucess);
    
    sub getStatus {
            my ($taskRef,$message) = @_;
    
            my $task_view = Vim::get_view(mo_ref => $taskRef);
            my $taskinfo = $task_view->info->state->val;
            my $continue = 1;
            while ($continue) {
                    my $info = $task_view->info;
                    if ($info->state->val eq 'success') {
                            print $message,"\n";
                            return $info->result;
                            $continue = 0;
                    } elsif ($info->state->val eq 'error') {
                            my $soap_fault = SoapFault->new;
                            $soap_fault->name($info->error->fault);
                            $soap_fault->detail($info->error->fault);
                            $soap_fault->fault_string($info->error->localizedMessage);
                            die "$soap_fault\n";
                    }
                    sleep 5;
                    $task_view->ViewBase::update_view_data();
            }
    }
    

    =========================================================================

    William Lam

    VMware vExpert 2009

    Scripts for VMware ESX/ESXi and resources at: http://engineering.ucsb.edu/~duonglt/vmware/

    Twitter: @lamw

    repository scripts vGhetto

    Introduction to the vMA (tips/tricks)

    Getting started with vSphere SDK for Perl

    VMware Code Central - Scripts/code samples for developers and administrators

    VMware developer community

    If you find this information useful, please give points to "correct" or "useful".

  • VMware-vim-cmd: waiting for orders to be completed?

    Hi all, I adapt a backup script I made for VMware Server 1.x to VMware Server 2.x and I'm having trouble doing ordinary things like 'suspend' or "create a snapshot" "a VM from starting.

    There are several ways to do the same thing in a certain way does not require any authentication, others indeed require authentication, for example, to create a snapshot, you can:

    VMware-vim-cmd vmsvc/snapshot.create 'id of the virtual machine.

    or

    vmrun-h https://127.0.0.1:8333 / sdk u user-p password of snapshot "[datastore] /vm_path/vmx_name.vmx '

    The problem with vmware-vim-cmd approach is that it does not wait for the command to complete, and is not a welcome feature in a script.

    Instead, the vmrun command wait until the end, but to use it in a script, you must also include the identification of the user and password information in the script, and it is not welcome.

    So the question (as shown in the topic) is: is it possible to make orders of vim-vmware-cmd to wait until the end?

    If someone knows how to do that I would be very grateful

    Thank you for reading,

    10nico

    The vimsh and the vimsh wrapper vmware-vim-cmd is not officially supported by VMware, that being said, I agree that it should allow you to check the situation, etc. It can be a pro/con and depending on how the call command, the wrappers actually communicate to the VI API server, and if you look at the VI API there are all both blocking and non call.

    Vmware-vim-cmd, the command is executed and returns to the shell for most. You might be able to monitor the tasks that is created and ensure that it is completed, but I have not played too much with it.

    [root@himalaya scripts]# vmware-vim-cmd vimsvc
    Commands available under vimsvc/:
    auth/             login             task_cancel       task_list
    connect           logout            task_description
    license           property_dump     task_info
    

    Again, these are undocumented, unsupported and the behavior will vary =)

    I advise to use the VI API (Powershell or VI Perl Toolkit) to accomplish your tasks, and you can even take a look at some of the utilities that are available with the VI Perl Toolkit Utilities: http://www.vmware.com/support/developer/viperltoolkit/viperl15/doc/perl_toolkit_utilities_idx.html

    =========================================================================

    William Lam

    VMware vExpert 2009

    Scripts for VMware ESX/ESXi and resources at: http://engineering.ucsb.edu/~duonglt/vmware/

    repository scripts vGhetto

    http://Twitter.com/lamw

    If you find this information useful, please give points to "correct" or "useful".

  • waiting for the task to the end host window.

    My computer startrd to show, when I restart or shutdown windows 7, I get a message saying that windows is waiting for the task host window to end what it means...?

    Hi Sanaaalsadouni,

    Thanks for posting your question in the Microsoft Community forums.

    The TASKHOST is a generic process, which acts as a host for the processes that are running DLL instead of exe files. Up TASKHOST checks the part Services of the registry to construct a list of services focused on the DLLS it needs to load, then load them.

    I suggest you try the procedure described in the article and see if it helps.

    Why my computer won't turn on or off quickly?
    http://Windows.Microsoft.com/en-us/Windows7/why-wont-my-computer-turn-on-or-off-quickly

    See the article for more information.

    See details about your computer's performance using Task Manager
    http://Windows.Microsoft.com/en-us/Windows7/see-details-about-your-computers-performance-using-Task-Manager

    Hope this information helps you. If you need additional help or information on Windows, I'll be happy to help you.

  • SHUTDOWN: waiting for active calls to complete.

    Hello

    environment is HP - UX 11.23, Version Oracle 9.2.0.5

    We had an ORA-600 error yesterday. We reported this error to support and suggested to install patch 9.2. 0.8

    However, I have a question. As you can see from the output to the alert log file it took a long time to stop the instance using the immediate option:

    Sun Nov 9 17:33:58 2008
    Closure of proceedings: in addition to logons disabled
    Closure of proceedings (immediate)
    License of the high waters = 454
    Sun Nov 9 17:39:07 2008
    Ongoing call for the program process 3991 user 'oracle' "oracle@xyz (TNS V1 - V3)"
    SHUTDOWN: waiting for active calls to complete.
    Sun Nov 9 17:50:36 2008
    ALTER DATABASE CLOSE NORMAL

    Is there anything, can be done in such a situation to accelerate the closure of the proceeding?

    Oracle database has an ease of use and a center of streams queues / advanced.
    These installations are possible by putting in place some auxiliary processes.
    These settings govern the number of processes.
    Their definition to 0 turns completely off the installation.
    You change the setting in memory, like you, that you have rebounded from the database, it will return to the value in the spfile and facilities will work again.
    Deactivation is especially useful when you that facilities are frequently used, that is to say you have a job running every 30 seconds.
    In the past, several databases, it was the only way to allow an immediate stop.

    Hope this helps,

    --
    Sybrand Bakker
    Senior Oracle DBA

  • waited for the parent session complete

    Hello

    I have a situation, where I have to put scenarios of execution in a package of ODI

    Let me explain


    package1 - scen1-> scen2-> scen3

    Package2 - scen4-> scen5-> scen6

    Package3 - scen7-> scen8-> scen9

    now I have to build a main package, where I call especially packages

    as

    PACKAGE FOR THE MAIN:
    package1_scen-> package2_scen-> package3_scen


    now I have to wait for lot 1 and all scenarios within package1 is completed before package2 started and same for package3


    I tried with odiwaitforchild session and running packag21_scen, package2_scen, package3_scen in synchronous mode

    but when I started the main package of all the scenarios running concurrently.


    can anyone suggest how to achieve this.

    Published by: 916710 on March 1, 2012 01:30

    Then exactly what problem faced while executions of pkg, are you generate script for internship (pkg) or not.

    scenario for each package to generate and put all the scenarios in a new package.

    See you soon,.
    Surya.

  • How to clear, waiting for the task in the task list

    Hi friends,
    When I configure the user, the process is in the list of tasks, as
    task: System validation
    status: pending

    I couldn't make the process to complete the procurement process...

    could someone help me by making the list of tasks.

    Gaetan elango.

    Check this box:

    Issue during the integration of IOM with novell edirectory 8.8 9.1

  • Waiting for a transition to be completed?

    I use Tweener.AddTween () to apply some transitions to my sprites who say quarter of a second. Once the transition is complete, I need to do something else. The problem is the line immediately after the transition is executed immediately (it does not wait for the transition to complete) and all that mess up. Is it possible in a synchronous way expect the transition ends without taking CPU in a loop, etc.?

    Hey p3pp3r,

    There is a setting for the tweener Oregon 'onComplete' call that performs a function is completed. It goes right into the addTween method.

    Here are more details on the onComplete parameter (along with several other more useful):

    http://hosted.Zeh.com.br/Tweener/docs/en-us/parameters/index.html

    example:

    Tweener.addTween(myobj, {x: 45, onComplete: myFunction});
    

    hope that helps. Good luck!

  • Wait for the mechanism in the parallel execution of packages

    Dear all,

    I submit two packets in parallel as below, which works very well.

    I present this in a shell script which is registered as a front end program.

    Front end program completed in a second, while the data are not visible in the tables, the data is visible only when the execution of the package completed.

    Please can you suggest a mechanism so that I can make the plsql block in shell script to wait for both the delivery of completed packages.

    #!/bin/sh                                                                                 |
    . $CUST_TOP/bin/CUST_ID_CM.env
    export INFA_USER=$INFA_USER
    export userpass=`(echo $1 | cut -f2 -d'"' | cut -d '"' -f3)`
    ploadtype=$5 
    pyear=$7
    #####################################################################
    if [ "$ploadtype" = "Restatement" ]; then
    sqlplus -s $userpass <<EOF
    set heading off feedback off verify off serveroutput on
    spool /usr/tmp/tmp_tph_load.txt
    DECLARE
      l_cnt NUMBER;
    BEGIN
      DBMS_SCHEDULER.CREATE_JOB(job_name            => 'YEARLY_RESTATEMENTS',
                                job_type            => 'STORED_PROCEDURE',
                                job_action          => 'RESTATEMENTS_DATAFEED_PKG.INSERT_RESTATEMENTS_P',
                                number_of_arguments => 1,
                                enabled             => FALSE,
                                auto_drop           => TRUE);
      DBMS_SCHEDULER.SET_JOB_ARGUMENT_VALUE(job_name          => 'YEARLY_RESTATEMENTS',
                                            argument_position => 1,
                                            argument_value    => '$7');
      DBMS_SCHEDULER.ENABLE('YEARLY_RESTATEMENTS');
      DBMS_SCHEDULER.CREATE_JOB(job_name            => 'YEARLY_ACTUALS',
                                job_type            => 'STORED_PROCEDURE',
                                job_action          => 'ACTUALS_DATAFEED_PKG.INSERT_ACTUALS_P',
                                number_of_arguments => 1,
                                enabled             => FALSE,
                                auto_drop           => TRUE);
      DBMS_SCHEDULER.SET_JOB_ARGUMENT_VALUE(job_name          => 'YEARLY_ACTUALS',
                                            argument_position => 1,
                                            argument_value    => '$7');
      DBMS_SCHEDULER.ENABLE('YEARLY_ACTUALS');
      LOOP
        SELECT COUNT(1)
          INTO l_cnt
          FROM DBA_SCHEDULER_RUNNING_JOBS
         WHERE UPPER(job_name) IN
               (UPPER('Yearly_Actuals'), UPPER('Yearly_Restatements'));
        EXIT WHEN l_cnt < 1;
      END LOOP;
    END;
    /
    EOF
    #
    fi
    exit
    

    Your problem is the timing. You can perform the check at DBA_SCHEDULER_RUNNING_JOBS before the entry is actually in there.

    Here is an example. I just submitted a PLSQL_BLOCK waiting for 60 seconds.

    SQL> DECLARE
      2    l_cnt NUMBER;
      3  BEGIN
      4    dbms_output.put_line(systimestamp || ' - Started');
      5    DBMS_SCHEDULER.CREATE_JOB(job_name            => 'YEARLY_RESTATEMENTS',
      6                              job_type            => 'PLSQL_BLOCK',
      7                              job_action          => 'BEGIN DBMS_LOCK.SLEEP(60); END;',
      8                              enabled             => FALSE,
      9                              auto_drop           => TRUE);
     10    DBMS_SCHEDULER.ENABLE('YEARLY_RESTATEMENTS');
     11
     12    LOOP
     13      SELECT COUNT(1) into l_cnt
     14        FROM DBA_SCHEDULER_RUNNING_JOBS
     15       WHERE UPPER(job_name) IN
     16             (UPPER('Yearly_Actuals'), UPPER('Yearly_Restatements'));
     17
     18      EXIT WHEN l_cnt < 1;
     19      dbms_output.put_line(systimestamp || ' - Waiting');
     20      dbms_lock.sleep(10);
     21    END LOOP;
     22    dbms_output.put_line(systimestamp || ' - Completed');
     23  END;
     24  /
    04-DEC-14 02.32.00.075794000 AM -05:00 - Started
    04-DEC-14 02.32.00.121862000 AM -05:00 - Completed
    
    PL/SQL procedure successfully completed.
    

    Now it ends immediately. But you can see that the job is still running.

    SQL>     SELECT COUNT(1)
      2        FROM DBA_SCHEDULER_RUNNING_JOBS
      3       WHERE UPPER(job_name) IN
      4             (UPPER('Yearly_Actuals'), UPPER('Yearly_Restatements'));
    
      COUNT(1)
    ----------
             1
    

    Now I make my code to wait 5 seconds before the audit

    SQL> DECLARE
      2    l_cnt NUMBER;
      3  BEGIN
      4    dbms_output.put_line(systimestamp || ' - Started');
      5    DBMS_SCHEDULER.CREATE_JOB(job_name            => 'YEARLY_RESTATEMENTS',
      6                              job_type            => 'PLSQL_BLOCK',
      7                              job_action          => 'BEGIN DBMS_LOCK.SLEEP(60); END;',
      8                              enabled             => FALSE,
      9                              auto_drop           => TRUE);
     10    DBMS_SCHEDULER.ENABLE('YEARLY_RESTATEMENTS');
     11
     12    -- Wait for a wile before checking
     13    dbms_lock.sleep(5);
     14    LOOP
     15      SELECT COUNT(1) into l_cnt
     16        FROM DBA_SCHEDULER_RUNNING_JOBS
     17       WHERE UPPER(job_name) IN
     18             (UPPER('Yearly_Actuals'), UPPER('Yearly_Restatements'));
     19
     20      EXIT WHEN l_cnt < 1;
     21      dbms_output.put_line(systimestamp || ' - Waiting');
     22      dbms_lock.sleep(10);
     23    END LOOP;
     24    dbms_output.put_line(systimestamp || ' - Completed');
     25  END;
     26  /
    04-DEC-14 02.33.09.294256000 AM -05:00 - Started
    04-DEC-14 02.33.14.347866000 AM -05:00 - Waiting
    04-DEC-14 02.33.24.369777000 AM -05:00 - Waiting
    04-DEC-14 02.33.34.389725000 AM -05:00 - Waiting
    04-DEC-14 02.33.44.410508000 AM -05:00 - Waiting
    04-DEC-14 02.33.54.430561000 AM -05:00 - Waiting
    04-DEC-14 02.34.04.450684000 AM -05:00 - Waiting
    04-DEC-14 02.34.14.462191000 AM -05:00 - Completed
    
    PL/SQL procedure successfully completed.
    
    SQL>
    

    Now you can see the code entered in the loop and waited.

  • The wait for the customization of the vm finish

    Hi, I am trying to find a way to wait for customization of vm finish before moving on to the next script. That's only 1 vm. I've seen a screenplay written by Lan Renouf, according to me, but I don't know how to change the script to look at the State of only 1 vm instead of several. Any help would be appreciated! Here is the link to Alan if anyone is interested:

    http://blogs.VMware.com/vipowershell/2012/08/waiting-for-OS-customization-to-complete.html '

    Thanks in advance

    Remove the RunAsync parameter

  • test_fwktutorial.jsp does not start... Waiting for [IP address]

    JDeveloper installed and configured for the 21662342 Patch.  For EBS R12.2.5

    Try to run test_fwktutorial.jsp.  IE will start, but he's white with spinning cursor.  No other answer... until that don't get server error internal 500 after 10 minutes.

    Here is the log of JDeveloper:

    [Departure OC4J uses the following ports: HTTP = 8988, RMI = 23891, JMS = 9227]
    C:\JDev1225\jdevhome\jdev\system\oracle. J2EE.10.1.3.43.6\embedded-oc4j\config >
    C:\JDev1225\jdevbin\jdk\bin\javaw.exe-client - classpath C:\JDev1225\jdevbin\j2ee\home\oc4j.jar; C:\JDev1225\jdevbin\jdev\lib\jdev-OC4J-embedded.jar-DFND_JDBC_STMT_CACHE_SIZE = 200 - DCACHENODBINIT = true - DRUN_FROM_JDEV = true - mx256m - XX: MaxPermSize = 512M - Doracle.j2ee.dont.use.memory.archive = false - Xverify: none - DcheckForUpdates = adminClientOnly - Doracle.application.environment = development - Doracle.j2ee.dont.use.memory.archive = true - Doracle.j2ee.http.socket.timeout = 500 - Doc4j.jms.usePersistenceLockFiles = false oracle.oc4j.loader.boot.BootStrap - config C:\JDev1225\jdevhome\jdev\system\oracle.j2ee.10.1.3.43.6\embedded-oc4j\config\server.xml
    [waiting for the server to complete its initialization...]
    Journal of the com.evermind.server.jms.JMSMessages January 8, 2016 16:17:46
    INFO: JMSServer []: Server OC4J JMS recovery of transactions (commit 0) (0 rollback) (prepared 0).
    Journal of the com.evermind.server.jms.JMSMessages January 8, 2016 16:17:46
    INFO: JMSServer []: Server OC4J JMS recovering local transactions queue [jms/Oc4jJmsExceptionQueue].
    16-01-08 16:17:47 WARNING: source Code C:\JDev1225\jdevbin\jdev\appslibrt\xml.jar (< draws > in C:/JDev1225/jdevhome/jdev/system/oracle.j2ee.10.1.3.43.6/embedded-oc4j/config/application.xml) has the same filename, but is not identical to /C:/JDev1225/jdevbin/lib/xml.jar (< source code > (ignore obvious Class-Path) in META-INF/boot.xml to C:\JDev1225\jdevbin\j2ee\home\oc4j.jar). If it contains different versions of the same classes, it will be hidden because it is already visible in the search path for the default.root:0.0.0 charger.
    16-01-08 16:17:47 WARNING: source Code C:\JDev1225\jdevbin\jdev\appslibrt\jazn.jar (< draws > in C:/JDev1225/jdevhome/jdev/system/oracle.j2ee.10.1.3.43.6/embedded-oc4j/config/application.xml) has the same filename, but is not identical to the /C:/JDev1225/jdevbin/j2ee/home/jazn.jar (< source code > in META-INF/boot.xml to C:\JDev1225\jdevbin\j2ee\home\oc4j.jar). If it contains different versions of the same classes, it will be hidden because it is already visible in the search path for the default.root:0.0.0 charger.
    16-01-08 16:17:47 WARNING: source Code C:\JDev1225\jdevbin\jdev\appslibrt\jazncore.jar (from manifesto of C:/JDev1225/jdevbin/jdev/appslibrt/jazn.jar) has the same filename, but is not identical to the /C:/JDev1225/jdevbin/j2ee/home/jazncore.jar (< source code > in META-INF/boot.xml to C:\JDev1225\jdevbin\j2ee\home\oc4j.jar). If it contains different versions of the same classes, it will be hidden because it is already visible in the search path for the default.root:0.0.0 charger.
    Ready message received from Oc4jNotifier.
    Incorporated the OC4J startup time: 6331 ms.

    URL - target http://172.18.10.43:8988/OA_HTML/test_fwktutorial.jsp
    16-01-08 16:17:49 containers for J2EE 10 g (10.1.3.5.0) initialized Oracle

    ANY THOUGHTS?

    Hello

    1. Please check your last file DBC with DBA and accountability provided by your system administrator.

    2 recheck your Jdeveloper setup steps.

    3 remove the jdeveloper House system folder & restart Jdeveloper.

    Kind regards

    Dilip

  • Wait for the entry?

    Hi all

    I need to create a custom entry dialog box and the problem I encountered is that I can't figure out how to make my request to wait for the user to complete the entries in the framework. When you use a JDialog or JOptionPane application will stop running and wait for the dialog box to close. My question is how to do something similar without using a JOptionPane or JDialog. I just can't figure out how to get the same effect by using a JFrame or other component. I know I could just use a JDialog or JOptionPane to get input from the user, but I'm just curious to know how I can stop running and wait for the entry as the JOptionPane allows you to do, but without using a JOptionPane or JDialog.

    Thank you for your help :)
    Nathan D.

    -----
    : Edit:
    I forgot to mention that the reason main I avoids JDialogs is I need the entry dialog box to be internal not external application I use mode exclusive fullscreen. And a JOptionPane does not allow me to add the other components too it such as JLabels and other GUI. I just need a way to get input from a component or internal window and wait for the entry as a JOptionPane or JDialog.
    -----

    A NBS are:

    import java.awt.event.*;
    import java.awt.*;
    import javax.swing.*;
    
    
    
    public class Main extends JFrame implements ActionListener {
    
        /**
         * @param args the command line arguments
         */
        public static void main(String[] args) {
            new Main();
        }
    
    
        JButton go = new JButton("Show custom input dialog");
    
        public Main() {
            setSize(300,150);
            setLocationRelativeTo(null);
            setLayout(new FlowLayout());
            go.addActionListener(this);
            add(go);
            setVisible(true);
        }
    
        public void actionPerformed(ActionEvent e) {
            InputDialog d = new InputDialog();
    
            /*
             * Here is the problem it is necessary that I create a
             * custom input dialog to allow further modifications however
             * i'm not sure how to wait for the user to enter text and press
             * continue in that input dialog. Unlike JOptionPane the code executes
             * before the user presses continue. My question is how do I wait for the user
             * to press continue in the InputDialog before I call d.getString(); without making the main
             * application unresponsive.
             */
    
            String returnValue = d.getString();
            System.out.println("return value "+returnValue); //will be null or empty because application doesn't wait for input.
        }
    
    
        class InputDialog extends JFrame implements ActionListener {
            JTextField f = new JTextField();
            JButton go = new JButton("Continue");
    
            public InputDialog() {
                setTitle("Custom Input Dialog");
                setSize(300,150);
                setLocationRelativeTo(null);
                setLayout(new FlowLayout());
                f.setPreferredSize(new Dimension(100,25));
                go.addActionListener(this);
                add(f);
                add(go);
                setVisible(true);
            }
    
            public void actionPerformed(ActionEvent e) {
    
            }
    
            public String getString() {
                return f.getText();
            }
        }
    }
    Published by: neptune692 on January 3, 2011 13:25

    neptune692 wrote:
    .. a JOptionPane does not allow me to add the other components too it such as JLabels and other GUI. ..

    Of course, it does!

    import java.awt.event.*;
    import java.awt.*;
    import javax.swing.*;
    
    public class DumbNameMain extends JFrame implements ActionListener {
    
        /**
         * @param args the command line arguments
         */
        public static void main(String[] args) {
            new DumbNameMain();
        }
    
        JButton go = new JButton("Show custom input dialog");
    
        public DumbNameMain() {
            setSize(300,150);
            setLocationRelativeTo(null);
            setLayout(new FlowLayout());
            go.addActionListener(this);
            add(go);
            setVisible(true);
        }
    
        public void actionPerformed(ActionEvent e) {
            JTextField f = new JTextField(10);
            JButton go = new JButton("Continue");
            JPanel p = new JPanel(new FlowLayout());
            p.add(f);
            p.add(go);
            JOptionPane.showMessageDialog( this, p );
    
            String returnValue = f.getText();
            System.out.println("return value "+returnValue);
        }
    }
    
  • Wait for the operator on the Clones Script related.

    I have a script to create linked clones (credit goes to the members of this forum to help me to do things), but I have problems with customizing the script tries to apply the customization until the clone is complete and I get the following:

    Script:

    to connect-viserver 'vCenter.

    $strtemplate = Read-Host "Please provide a model to create Clones related to:
    $strVMName = Read-Host "Please provide a Naming Convention, (Ex: CTX #).
    $strStart = Read-Host "Please provide a Naming Convention number from (EX: 1 = CTX1)"»
    $strEnd = Read-Host "Please provide a Convention assignment of names ending number (EX: 3, will create CTX1, CTX2, CTX3)".

    $intStart = [System.Convert]: ToInt32 ($strStart)
    $intEnd = [System.Convert]: ToInt32 ($strEnd) + 1

    for ($i = $intStart; $i - lt $intEnd; $i ++) {}
    $sourceVM = get - VM $strtemplate | Get-View
    $cloneName = "$strVMNAME$ I".
    $cloneFolder = $sourceVM.parent
    $cloneSpec = new-object Vmware.Vim.VirtualMachineCloneSpec
    $cloneSpec.Snapshot = $sourceVM.Snapshot.CurrentSnapshot
    $cloneSpec.Location = new-object Vmware.Vim.VirtualMachineRelocateSpec
    $cloneSpec.Location.DiskMoveType = [Vmware.Vim.VirtualMachineRelocateDiskMoveOptions]: createNewChildDiskBacking
    $sourceVM.CloneVM_Task ($cloneFolder, $cloneName, $cloneSpec)
    Sleep 10
    Set-VM "$strVMNAME$ I"-OSCustomizationSpec "" CTX-customization-confirm: $false
    Start-VM "$strVMNAME$ I '-RunAsync-confirm: $false
    }

    The error:

    Set-VM: 25/01/2012 17:13:24 Set - VM, the object has already been dele

    Ted, or not completely created

    To C:\Users\lpalacio\Documents\Scripts\VMware PowerCLI\Create-link - Ask.ps1:21

    character: 12

    + Set - VM < < < < ' $strVMNAME$ I "-OSCustomizationSpec" "CTX-customization - co

    nfirm: $false

    + CategoryInfo: NotSpecified: (:)) [game - VM], VimException)

    + FullyQualifiedErrorId: Core_BaseCmdlet_UnknownError, VMware.VimAutomatio

    n.ViCore.Cmdlets.Commands.SetVM

    Is there a way to tell the script to wait until the clone is finished? I know I can use a sleep command but not all clones will take as much time to complete.
    Thank you.

    You can try to wait here it is finished

    ...

    $taskMoRef = $sourceVM.CloneVM_Task ($cloneFolder, $cloneName, $cloneSpec)

    $task = get-views $taskMoRef

    While ("running", "pending" - contains $task.Info.State) {}

    $task. UpdateViewData ("Info")

    sleep 5

    }

    ....

Maybe you are looking for

  • How do I disable find my iPhone for an iOS since another device iOS device using a browser?

    I want to disable find my iPhone for my iPhone (who died), friends iPhone (it's just an example, not really happened to me).  So I open Safari or Chrome and go to iCloud.com.  Yet, the browser takes me to the "icloud.com/iPhone_Welcome" and I can't d

  • change the names of files using AppleScript

    I'm working on a website that will have several hundred PDFs. For some reason, all the file names include Plus-signes and hyphens instead of wordspaces. (Presumably, this is how they treated the problem of the %20 appears so when the visible name has

  • Remove the dialogue during the closing of DIAdem

    How do I remove or close the dialog box that appears when the tiara was closed if data or page layouts have been changed via SCRIPT? I tried: CmdNoDialogDisp = TRUE CmdNoWarningDisp = TRUE CmdNoMsgDisp = TRUE CmdNoErrorDisp = TRUE CmdNoInfoDisp = TRU

  • followed by Windows memory program

    Hello I want to monitor the total amount of memory used by a Windows process. Something like the Windows Task Manager. It's abbrevations used to get the amount of memory used an application created with Labview. I know there are several ways to calcu

  • Cooler T400 program

    Hello everyone quick question: is there a program to access the cooler of my T400 or my ATI HD 3400 series? because I use it for games from time to time, and (of course) stops when it gets too hot. With Win7 X 64 All responses appreciated