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/
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/
and then edit crontab to:
33 23 * * * /temp/testmail/
if user1's shell is /opt/bin/bash anyway, this [c|sh]ould work as well - no su required:
33 23 * * * user1 /temp/testmail/
Marc
--- In nslu2-linux@
> 4)So I added "/bin/su user1 -c" to my script :
> 33 23 * * * /bin/su user1 -c '/opt/bin/bash /temp/testmail/
>
> And this is OK now !
>
Tuesday, November 24, 2009
[nslu2-linux] Re: [openslug] Send mail with nail in crontab
__._,_.___
MARKETPLACE
.
__,_._,___
No comments:
Post a Comment