1846541 Members
2378 Online
110256 Solutions
New Discussion

at job

 
navin
Super Advisor

at job

Hello ,
I have a at job like this and it send the e-mail to me automatically once the job ran. i do not want to get the e-mail , i want to redirect the output or error to a file . please advice how can i do it.Thanks much

at -f /tmp/test now

----------------
I have tried like this ..it did not work
at -f /tmp/test now >/tmp/out
Learning ...
5 REPLIES 5
James R. Ferguson
Acclaimed Contributor

Re: at job

Hi Navin:

# at -f /tmp/test now > /dev/null 2>&1

Regards!

...JRF...
navin
Super Advisor

Re: at job

James,
Still getting the e-mail notification.
please advice..would like to have no e-mail notification
thanks
Learning ...
piyush mathiya
Trusted Contributor

Re: at job

Can you send me the contains of the script,

or you can use the following line at the starting of the script. and if you are using mailx or sendmail command in your script then you have to comment that line to avoid mail.

exec 2> /tmp/out 1>&2

Regards,
Piyush Mathiya
navin
Super Advisor

Re: at job

no ..it is a test script , i have only 2 lines in there just to echo the $PATH. i did not include any email command.Thanks
Learning ...
James R. Ferguson
Acclaimed Contributor

Re: at job

Hi (again) Navin:

Well, it seems that we need to do something different.

Choice one, since this is an immediate run is to substitute 'batch' and do:

# batch < /tmp/mytest > /tmp/mylog 2>&1
> !!

Type this at the prompts as shown

The methodology I commonly use for scripts that might or might not be 'cron'ed (or run via 'at') is something like this:

# cat mytest
#!/usr/bin/sh
[ -t 0 ] || exec > /tmp/mylog.$$ 2>&1
echo "this is from STDOUT\n"
print -u2 "this is from STDERR\n"

This tests to see if a terminal (for STDIN) is associated with the process. If not, it is assumed that all output should be redirected to a file.

Regards!

...JRF...