smartybob has asked for the wisdom of the Perl Monks concerning the following question:

Hey, i am trying to use perl to execute some system command such as at. I am using  system("at -f test 1205");

however, with teh code system("at -f test 1205 & echo /$! > /a"); i could only get the process id. But i need the job id.. instead. How can i track the job id into a file.

I am using solaris 8.

Thanxs..

Edit kudra, 2001-12-23 Added markup

Replies are listed 'Best First'.
Re: At process job id
by japh (Friar) on Dec 24, 2001 at 01:14 UTC
    `at` sends things like 'at>' prompts, '<EOT>' tags and the closing banner to STDERR, which you can capture and run through a regexp:
    # format: job 4 at 2001-12-24 14:00 my ($job_id,$job_date,$job_time) = (/job (\d+) at (\S+) (\S+)/);
      hi, however, i dun really get you. if that is the command to run, how about my file. i need to execute the command and at the same time track the job id. I hope it gives you a better idea. Thanxs
        Then here is a full working example:
        # file an `at` job of running contents of 'file' at 12:05 open AT, "at -f test 1205 2>&1 |" || die "can't `at`"; while(<AT>) { ($job_id,$job_date,$job_time) = (/^job (\d+) at (\S+) (\S+)/); + } # last one seen wins print "at job ID: $job_id\n";