Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I'm trying to use a PHP script to create at jobs, but when it comes time to execute the jobs, nothing seems to be happening. I've tried to output any errors to log files, but have had no luck. It seems obvious that it's a permissions issue, because when I set apache to run as my personal user, everything works fine. However, when I exec wget directly from PHP, everything works fine so it seems that apache has the correct permissions to use it. The problem appears to be when using at in conjunction with apache. So I need to find a way to make this work with apache running as its own user.

Here is the command I'm using:

echo "wget -qO-" | at now + 1 minute 2>&1

Any ideas?

EDIT: Apache can create the at jobs, it just seems that when they execute nothing is happening.

share|improve this question
This is almost certainly the wrong way to do it. I've no idea what the right one is, though. – Tom O'Connor Jun 25 '12 at 14:41
when I try to run the wget command above on my site (just the wget bit ie. wget -q0-"; ) I'm gettin errors... – gyre Jun 25 '12 at 15:04
wrote it out wrong, it should be -qO-, with an O not a zero – Alex Padgett Jun 25 '12 at 15:12

Did you check to see if the apache user is in the at.allow file? Per the man page...

       The  /etc/at.allow and /etc/at.deny files determine which user can sub-
   mit commands for later execution via at(1) or batch(1).

   The format of the files is a list  of  usernames,  one  on  each  line.
   Whitespace is not permitted.

   The superuser may always use at.

   If  the  file  /etc/at.allow exists, only usernames mentioned in it are
   allowed to use at.

   If /etc/at.allow does not exist, /etc/at.deny is checked.
share|improve this answer
at.allow does not exist, but at.deny is empty. Apache can create the at jobs, it just seems that when they execute nothing is happening. – Alex Padgett Jun 25 '12 at 14:45
I have a feeling I've done this before.. but it wasn't for apache or php.. I can't remember what it was. – Tom O'Connor Jun 25 '12 at 14:45

The problem is similar to that of cron : your job execute in a minimal environment (think PATH=/bin:/usr/bin and 2 or 3 things) and with nothing attached to its standard input and outputs.

First make sure your Apache account as a working shell (and not /bin/false), because 'at' will use this shell to run your jobspec.

Then try this more specific snippet :

echo "/usr/bin/wget -qO- >/tmp/ 2>/tmp/" | at now + 1 minute

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.