Re: Change cron output to other user




Nathan Dietsch wrote:
Hi Moonhk,

moonhk wrote:
tunla wrote:

moonhk wrote:

OS : SunOS Generic_105181-39 sun4u sparc SUNW,Ultra-4

I received below mail many years. How to change to other user name ?

If you want to redirect mail from your account to another account, use a
.forward file. Note: That will redirect all mail.

If you want to send the output from this cronjob to another user and
stop getting the mails yourself, pipe it to mailx and send it to the
other user. In this case;

N N N N N /export/home/users/eric/callbat.ksh -s 2>&1 | mailx -s "Cron
output" user@xxxxxxxxxx

That will send STDOUT and STDERR to the other user.

I hope this helps.

Kind Regards,

Nathan Dietsch


Your "cron" job on machine_A
/export/home/users/eric/callbat.ksh -s

produced the following output:

This is Process_MPS


Cron sends mail to the user who ows the crontab file
that produces the output. ( unless you have been tinkering with
/etc/mail/aliases )

If you dont want/need the output from the job you can:
redirect the output to /dev/null

edit crontab entry to look like this.

23 4 * * * /some/command/name > /dev/null 2>&1


//Lars


Thank. I still need the cron output. I want change to other person.

I check the /etc/mail/aliases, have below content.
# Following alias is required by the mail protocol, RFC 822
# Set it to the address of a HUMAN who deals with this system's mail
problems.
Postmaster:root

We using other SMTP server to send mail. Is it some setting in SMTP
server, redirect to my name ?


Thank, But this is not my want. In UNIX or smtp server, should be have
setting send the cron output to me.
In our case, if cron have any output or scrip have error, I will
receive as below

eg.
In crontab input
00 1 * * * /export/home/users/batch/xcp_batlog.ksh

In my mail account will have below mail
Your "cron" job on xxxxx
/export/home/users/batch/xcp_batlog.ksh

produced the following output:

cp: cannot access /export/eoj.prn

.



Relevant Pages

  • Re: Change cron output to other user
    ... moonhk wrote: ... If you want to redirect mail from your account to another account, ... That will redirect all mail. ... Cron sends mail to the user who ows the crontab file ...
    (comp.unix.solaris)
  • Re: Change cron output to other user
    ... Cron sends mail to the user who ows the crontab file ... redirect the output to /dev/null ... edit crontab entry to look like this. ... We using other SMTP server to send mail. ...
    (comp.unix.solaris)
  • Re: Cron ?
    ... Normally bash is interactive environment. ... But cron is not. ... By default cron does not create an user environment. ... You do not need to redirect the output, it will be mailed to the user owning the crontab. ...
    (linux.redhat)
  • Re: PHP, cron and stdout redirection
    ... Php does run as an Apache SO. ... per the redirect) ... The entry in cron log suggests that it works perfectly. ... an cron-scripted output to a page for the same DB lookups. ...
    (comp.lang.php)
  • Re: PHP, cron and stdout redirection
    ... Php does run as an Apache SO. ... per the redirect) ... The entry in cron log suggests that it works perfectly. ... an cron-scripted output to a page for the same DB lookups. ...
    (comp.lang.php)