environment variables generated by at command

Posted by Jordan Arseno on Server Fault See other posts from Server Fault or by Jordan Arseno
Published on 2012-09-29T20:37:08Z Indexed on 2012/09/29 21:39 UTC
Read the original article Hit count: 189

Filed under:
|
|
|

I'm inspecting /var/spool/cron/atjobs/a001cf01570e44 with cat, after running the at command from PHP using exec().

It looks like at has prepended the script with lots of APACHE environment variables.

#!/bin/sh
# atrun uid=33 gid=33
# mail www-data 0
umask 22
APACHE_RUN_DIR=/var/run/apache2; export APACHE_RUN_DIR
APACHE_PID_FILE=/var/run/apache2.pid; export APACHE_PID_FILE
PATH=/usr/local/bin:/usr/bin:/bin; export PATH
APACHE_LOCK_DIR=/var/lock/apache2; export APACHE_LOCK_DIR
LANG=C; export LANG
APACHE_RUN_USER=www-data; export APACHE_RUN_USER
APACHE_RUN_GROUP=www-data; export APACHE_RUN_GROUP
APACHE_LOG_DIR=/var/log/apache2; export APACHE_LOG_DIR
PWD=/home/jordanarseno/webroot/public_html/myapp; export PWD
cd /home/jordanarseno/webroot/public\_html/myapp || {
     echo 'Execution directory inaccessible' >&2
     exit 1
}
curl -k http://localhost/myapp/crons/this_action/3

The last line is the only real command I sent along with at via stdin. What is the purpose of these variables? Where is this procedure stored?

© Server Fault or respective owner

Related posts about apache2

Related posts about php