I am on CentOS 5, running Apache2. My website contains a page where users can submit a job that could take some time to run, so I want to submit the job to the batch queue to run it when system load is low and email the user the results when it is done.
The website is done in Perl CGI, and I submit the job with a system call like this:
system(" echo \"$cmd\" | batch 1>/abs/path/to/tmp_dir/batch_outfile.txt 2>&1 ")
It didn't work with the command I really need to run, so I tried it with a very simple command, i.e.
$cmd = "echo 'test' > /abs/path/to/tmp_dir/test.txt"
When the webserver submits this command, it seems to get added to the batch queue, because the file I redirect STDERR and STDOUT to from batch looks like this:
job 25 at 2008-02-15 16:35
However, the result file "test.txt" doesn't appear and when I run
as super-user I don't see the submitted job, so it is not pending either.
Running the same batch submission command
echo "echo 'test' > /abs/path/to/tmp_dir/test.txt" | batch
under my own account or the super-user works without problems.
I don't have a file /etc/at.allow and my /etc/at.deny is empty, so the apache-server (running as user "nobody") should be able to access the batch queue.
User "nobody" has permissions to write to the target directory (it writes some other temp files to that directory and there are no problems with that either).
I'm running out of ideas and would appreciate your help. Thanks a lot!