LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Software (https://www.linuxquestions.org/questions/linux-software-2/)
-   -   Permission denied @ /var/log/mail (https://www.linuxquestions.org/questions/linux-software-2/permission-denied-%40-var-log-mail-111799/)

Thorsten 11-03-2003 07:08 AM

Permission denied @ /var/log/mail
 
Hey guys, hope you can help me:

I have a shellscript which has a problem with mailing.

I post the whole stuff 'set -xv' prints out:



TMPFOLDER="/tmp"
+ TMPFOLDER=/tmp
MAILLOGALL="$TMPFOLDER/maillog.all"
+ MAILLOGALL=/tmp/maillog.all
PATH="/var/log"
+ PATH=/var/log
TO="xx@yy.de"
+ TO=xx@yy.de

trap "/bin/rm -f $TMPFOLDER/spamstat.$$; /bin/rm -f $MAILLOGALL" 0 1 2 3 15
+ trap '/bin/rm -f /tmp/spamstat.18857; /bin/rm -f /tmp/maillog.all' 0 1 2 3 15

/bin/touch $MAILLOGALL
+ /bin/touch /tmp/maillog.all
/bin/chmod 600 $MAILLOGALL
+ /bin/chmod 600 /tmp/maillog.all

/bin/cat $PATH/maillog.4 >> $MAILLOGALL
+ /bin/cat /var/log/maillog.4
/bin/cat $PATH/maillog.3 >> $MAILLOGALL
/bin/cat $PATH/maillog.2 >> $MAILLOGALL
/bin/cat $PATH/maillog.1 >> $MAILLOGALL
/bin/cat $PATH/maillog >> $MAILLOGALL

/usr/local/bin/spamstats -file $MAILLOGALL -number 10 -duration 2592000 > $TMPFOLDER/spamstat.$$
+ /usr/local/bin/spamstats -file /tmp/maillog.all -number 10 -duration 2592000

mail -s "Monthly spam statistic of 'hostname' " $TO < $TMPFOLDER/spamstat.$$
+ mail -s 'Monthly spam statistic of '\''hostname'\'' ' xx@yy..de
./email_spamstats_monthly30: line 23: /var/log/mail: Permission denied
/bin/rm -f /tmp/spamstat.18857; /bin/rm -f /tmp/maillog.all
+ /bin/rm -f /tmp/spamstat.18857
+ /bin/rm -f /tmp/maillog.all



If you need other information please tell me.
Additionally:
If I don't remove the spamstat.$$ an mail it manually I don't get problems...


Thanks in advance,

Thorsten

jailbait 11-03-2003 06:44 PM

I think that your problem is that you are using PATH as a variable when bash uses the PATH variable to find programs to run. Your script runs OK until you get to this statement:
mail -s "Monthly spam statistic of 'hostname' " $TO < $TMPFOLDER/spamstat.$$
Then bash goes to the directory /var/log and looks for an executable program called mail.
Whatever /var/log/mail might be, it is not an executable program so you get a permissions error.

I suggest that you rename your PATH variable to something that Linux does not use.


___________________________________
Be prepared. Create a LifeBoat CD.
http://users.rcn.com/srstites/LifeBo...home.page.html

Steve Stites


All times are GMT -5. The time now is 04:43 PM.