Discussion:
mutt and cron
(too old to reply)
Laurent
2011-11-16 15:22:26 UTC
Permalink
Hi everybody !

I'm using mutt to compact the inbox boxes of my users.

I've made a small shell script with an iteration which work well when
launched in a shell :

for mbox in `ls -b -1 /var/spool/mail/*` ;
do
mutt -f $mbox -e 'set folder=/dev/null; set delete=yes; push "<quit>"'
.../...

But when launched with cron, it doesn't work, and said "No recipients
were specified."

Do someone have an idea ?

thx :)

Laurent.
Laurent
2011-11-16 15:54:28 UTC
Permalink
Post by Laurent
But when launched with cron, it doesn't work, and said "No recipients
were specified."
I forgot to give the mutt version : Mutt 1.5.17 (2007-11-01)
... which I must admit is an old version :)
Jochen Schmid
2011-11-22 21:03:28 UTC
Permalink
Post by Laurent
for mbox in `ls -b -1 /var/spool/mail/*` ;
do
mutt -f $mbox -e 'set folder=/dev/null; set delete=yes; push "<quit>"'
.../...
But when launched with cron, it doesn't work, and said "No recipients
were specified."
Perhaps $mbox is not set when starting mutt from cron?
--
Regards,
Jochen
Piotr Isajew
2011-11-23 11:03:32 UTC
Permalink
Post by Jochen Schmid
Post by Laurent
for mbox in `ls -b -1 /var/spool/mail/*` ;
do
mutt -f $mbox -e 'set folder=/dev/null; set delete=yes; push "<quit>"'
.../...
But when launched with cron, it doesn't work, and said "No recipients
were specified."
Perhaps $mbox is not set when starting mutt from cron?
I suspect it's rather that mutt behaves differently when launched
without controlling terminal. Try changing that script to launch
mutt in detached screen session.
Jochen Schmid
2011-11-25 14:48:54 UTC
Permalink
Post by Piotr Isajew
Post by Jochen Schmid
Post by Laurent
for mbox in `ls -b -1 /var/spool/mail/*` ;
do
mutt -f $mbox -e 'set folder=/dev/null; set delete=yes; push "<quit>"'
.../...
But when launched with cron, it doesn't work, and said "No recipients
were specified."
Perhaps $mbox is not set when starting mutt from cron?
I suspect it's rather that mutt behaves differently when launched
without controlling terminal. Try changing that script to launch
mutt in detached screen session.
A small test would clarify that: Just put a

echo $mbox >> /tmp/mutttest.log
--
Regards,
Jochen
Kai Burghardt
2013-10-11 00:53:19 UTC
Permalink
Hi,
Post by Laurent
But when launched with cron, it doesn't work, and said "No recipients
were specified."
You know cron jobs are (by default) run in a reduced environment, don't
you? With whose priveleges are the cron-task run? If it is root, i'd
advise you to encapsulate at least mutt into a su-env.
--
Sincerely yours
Kai Burghardt
l***@vordruckleitverlag.de
2018-09-18 10:34:10 UTC
Permalink
Hi,

late but better then never: I just had the same problem: mutt needs a real terminal. There is no trivial way to provide cron with a tty. Maybe something with ssh -t will work. I gave up and call the task from my .profile in background with a sleep managed roundtime. Possible because it's interesting for me only if I'm logged in.

cu jth

Loading...