in reply to Re: At process job id
in thread At process job id

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

Replies are listed 'Best First'.
Re: Re: Re: At process job id
by japh (Friar) on Dec 25, 2001 at 01:31 UTC
    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";
      i had tried the above method recommended. However, when i run the code with the output append to a file. This doesn't work. the $job_id simply return a empty field. Why? Pls.. help..
        It's probably a difference between Linux and Solaris `at` output - adjust the regexp accordingly.
      hey, i had tried the above command in my perl script. however, it doesn't give me the value i want. instead, it return an empty values for all the 3 fields. WHY ?
        Then your regexp is probably wrong. If you do this:
        echo "ls" | at -f test 1205 >at.stdout 2>at.stderr
        (where 'test' is your example input file) then paste the contents of at.stdout and at.sterr here, we can figure out the applicable regexp for your system.