Tuesday, November 24, 2009

[nslu2-linux] Re: [openslug] Send mail with nail in crontab

 



The error message: "/usr/lib/sendmail: No such file or directory" points to a missing PATH to sendmail

I believe this is what happens now causing your script to run successfully. Your command:
/bin/su user1 -c '/opt/bin/bash /temp/testmail/send_mail.sh'
causes user1 to use /opt/bin/bash as a shell.
If you have e.g. a .bash_profile in user1's $HOME this profile will be sourced setting PATH variable and all the environment you have when you log in as user1. This makes the shell and the cron environment match and e.g. PATH will be set correctly.

I bet that you could run this as root as well if you source root's profile prior to the command, like adding:

. ~/.bash_profile or
. ~/.profile (depends on which shell your root has) to your
script: /temp/testmail/send_mail.sh

and then edit crontab to:

33 23 * * * /temp/testmail/send_mail.sh

if user1's shell is /opt/bin/bash anyway, this [c|sh]ould work as well - no su required:

33 23 * * * user1 /temp/testmail/send_mail.sh

Marc

--- In nslu2-linux@yahoogroups.com, "tkayna" <tkayna@...> wrote:

> 4)So I added "/bin/su user1 -c" to my script :
> 33 23 * * * /bin/su user1 -c '/opt/bin/bash /temp/testmail/send_mail.sh'
>
> And this is OK now !
>

__._,_.___
.

__,_._,___

No comments:

Post a Comment