Wait for Jobs

Waiting for jobs is especially useful for scripts. By default, nc run returns immediately after you submit a job. This allows you to submit multiple jobs at once. There could be times when you want to run jobs in sequence, in which case option -w is very useful. With this option, nc run waits for the job(s) to finish ( Done or Failed ).
% nc run -w sleep 10
Resources= linux
Env      = D(VOV_ENV_SOURCE=vnc_logs/envdexin36362.env)
Command  = vw vwrap sleep 10
Logfile  = vnc_logs/20021231/111314.21781
JobId    = 04211346
vnc: message: Scheduled jobs: 1       Total estimated time: 0s

Wait for Jobs and Show Log File of the last job: -wl

With this option, nc run waits for the job(s) and shows the log file of the last job.
% nc run -wl date
Resources= linux
Env      = D(VOV_ENV_SOURCE=vnc_logs/envdexin36362.env)
Command  = vw vwrap date
Logfile  = vnc_logs/20021231/111530.21819
JobId    = 04211392
nc: message: Scheduled jobs: 1       Total estimated time: 0s
<<<STARTING ON rhino>>>
Tue Dec 31 11:15:31 PST 2002
<<<END OF LOG>>>
<<<EXIT STATUS 0>>>

Please only use -wl for jobs where you are actively monitoring the output. Such jobs listen to the vovservers event stream and are called 'notify clients'. They are more resource-intensive than plain batch jobs.

Wait for Jobs Using nc wait

You can also wait for jobs using the command nc wait. We will cover that in next tutorial "Job Control".