LinuxQuestions.org
View the Most Wanted LQ Wiki articles.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices

Reply
 
Search this Thread
Old 11-03-2003, 07:08 AM   #1
Thorsten
LQ Newbie
 
Registered: Aug 2003
Distribution: Redhat 9.0
Posts: 14

Rep: Reputation: 0
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

Last edited by Thorsten; 11-03-2003 at 07:10 AM.
 
Old 11-03-2003, 06:44 PM   #2
jailbait
Guru
 
Registered: Feb 2003
Location: Blue Ridge Mountain
Distribution: Debian Wheezy, Debian Jessie
Posts: 7,474

Rep: Reputation: 155Reputation: 155
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
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Permission Denied when trying to delete /var robintw Linux - General 4 09-17-2005 02:00 PM
/var/log/messages - kernel: audit(1107868785.573:0): avc: denied { getattr } lothario Linux - Security 2 02-10-2005 04:24 AM
cps printing problem - /var/spool (permission denied) carboncopy Slackware 10 11-11-2004 03:28 AM
/var/log/news permission denied tt08 Linux - Newbie 4 10-30-2004 10:19 AM
HELP -- .forward.mail: Permission denied kepweng Linux - Software 1 04-16-2004 07:32 AM


All times are GMT -5. The time now is 02:42 PM.

Main Menu
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration