0

I wanted to know if I can access the custom env variables that are set while adding a script to the "at" command queue before it runs ? I understand that certain system env variables like: TERM, DISPLAY, SHELLOPTS, _, PPID, BASH_VERSINFO, EUID, UID, GROUPS are excluded, but if there is a custom env set when I add my script to atq, I know that gets recorded and when my script runs it uses that value.

What I wanted to know is if I can get access to those values before "at" runs my script ?

Suppose I set a env variable called: TEST_DIR. Now in my perl script I am accessing the value of it. I add an entry to "at" command to call my perl script say at 10 in the night. I exit the session, login again before 10pm, is there a way for me to access the value of TEST_DIR that is recorded in the "at" queue ? I know when the script runs at 10pm whatever value was set at the time of adding to "at" queue will be considered but I wanted to know the value of it.

I have googled everywhere and have gone through the man pages of "at", it talks about env values being stored but doesn't tell where it is stored. Any help would be very much appreciated.

Thank You.

1 Answer 1

1

at stores its jobs as shell scripts which set up the job’s environment (variables and working directory). You can see these by running

at -c ${jobid}

replacing ${jobid} as appropriate (see atq). You’ll find the value of TEST_DIR in the output.

1
  • Thank you so much Stephen. I was about to reply saying I had already checked "at -c" option and couldn't find the TEST_PARAM details but thought will check again and voila! the details are indeed there. Probable I was half asleep when I checked yesterday. Thanks again. Commented Jan 18, 2020 at 10:20

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.