+if ( $list ) {
+
+ warn "list all jobs for $id\n";
+
+ my @active = ();
+ my @queued = ();
+ my $hostname = $q->dq->gethostname();
+
+ sub wanted {
+ my ($visitcontext, $job) = @_;
+
+ my $data = $job->get_data_path();
+ my $nbytes = $job->get_data_size_bytes();
+ my $timet = $job->get_time_submitted_secs();
+ my $hname = $job->get_hostname_submitted();
+ my $jobid = $job->{jobid};
+
+ my $text = sprintf (
+ "%s (%d bytes)\n Submitted: %s on %s\n",
+ $jobid, $nbytes, scalar localtime $timet, $hname);
+
+ $text .= read_file( $data ) || die "can't open $data: $!";
+
+ if ($job->{active_pid})
+ {
+ if ($hostname eq $job->{active_host}
+ && !kill (0, $job->{active_pid}))
+ {
+ $text = sprintf (
+ "(dead lockfile)\n %s",
+ $text);
+ }
+ else {
+ $text = sprintf (
+ "(pid: %d\@%s)\n %s",
+ $job->{active_pid}, $job->{active_host}, $text);
+ }
+
+ push (@active, $text);
+ }
+ else {
+ push (@queued, $text);
+ }
+
+ $job->finish();
+ }
+
+ $q->dq->visit_all_jobs(\&wanted, undef);
+ printf "Jobs: active: %d queued: %d\n",
+ scalar @active, scalar @queued;
+
+ print "Active jobs [", scalar @active, "]\n",join("\n\n", @active) if @active;
+ print "Queued jobs [", scalar @queued, "]\n",join("\n\n", @queued) if @queued;
+
+} else {
+
+ warn "injecting some tests commands\n";
+
+ $q->enqueue( 'SetParameterValues', {
+ 'InternetGatewayDevice.DeviceInfo.ProvisioningCode' => 'test provision',
+# 'InternetGatewayDevice.DeviceInfo.X_000E50_Country' => 1,
+ });
+
+ $q->enqueue( 'GetParameterValues', [
+ 'InternetGatewayDevice.DeviceInfo.ProvisioningCode',
+ ]);
+
+}