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

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";

Replies are listed 'Best First'.
Re: Re: Re: Re: At process job id
by smartybob (Initiate) on Dec 25, 2001 at 10:15 UTC
    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.
Re: Re: Re: Re: At process job id
by smartybob (Initiate) on Dec 28, 2001 at 22:06 UTC
    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.
        Hi, When i run the above stated above, it display the below message >>> "Ambiguous output redirect." And i check the at queue by the atq command. and there is now queue of the at command, which the command above is not executed at all. Reply PLS !