Date: Mon, 2 Mar 2009 18:40:08 -0500 From: APseudoUtopia <apseudoutopia@gmail.com> To: Frank Shute <frank@shute.org.uk>, freebsd-questions@freebsd.org Subject: Re: Cron Not Sending Mail Message-ID: <27ade5280903021540h2a4d9178vd0ec0a47c8124fb8@mail.gmail.com> In-Reply-To: <20090302020336.GA18386@melon.esperance-linux.co.uk> References: <27ade5280903011124v4d6d9fdq2071d5ab44a37ca9@mail.gmail.com> <20090302020336.GA18386@melon.esperance-linux.co.uk>
next in thread | previous in thread | raw e-mail | index | archive | help
On Sun, Mar 1, 2009 at 9:03 PM, Frank Shute <frank@shute.org.uk> wrote: > On Sun, Mar 01, 2009 at 02:24:47PM -0500, APseudoUtopia wrote: >> >> Cron is not sending output as emails. I noticed this when I stopped >> seeing the output of a backup script in my daily email. I thought >> there was a problem with the backup script - but no, it's cron not >> sending the emails. >> >> I had this problem before on 6.1, which I never found a solution to. I >> gave up on it, and eventually I upgraded to 7.1. After the upgrade, >> cron worked perfectly. However, I just noticed that it stopped working >> again. I have no idea what changed (It's a production server, I >> haven't been playing with config files). >> >> User www's mail is redirected to root, which is redirected to a @gmail >> account via /etc/aliases. >> This is on 7.1-RELEASE-p3 running a custom kernel. >> >> Any solution to this problem would be fantastic. I use the emails from >> cron on a daily basis, and it really messes me up to have it not >> working. >> >> ##### >> # User www's crontab >> # Note, I also tried removing the MAILTO to no avail >> ##### >> MAILTO=3Droot >> # m =C2=A0 =C2=A0 h =C2=A0 =C2=A0 =C2=A0 dom =C2=A0 =C2=A0 mon =C2=A0 = =C2=A0 dow =C2=A0 =C2=A0 cmd >> * =C2=A0 =C2=A0 =C2=A0 * =C2=A0 =C2=A0 =C2=A0 * =C2=A0 =C2=A0 =C2=A0 * = =C2=A0 =C2=A0 =C2=A0 * =C2=A0 =C2=A0 =C2=A0 echo "Hello" >> >> >> #### >> # /var/log/cron >> #### >> Mar =C2=A01 19:22:00 youcant /usr/sbin/cron[22627]: (operator) CMD >> (/usr/libexec/save-entropy) >> Mar =C2=A01 19:22:00 youcant cron[22627]: NSSWITCH(nss_method_lookup): n= is, >> group_compat, setgrent, not found >> Mar =C2=A01 19:22:00 youcant cron[22627]: NSSWITCH(nss_method_lookup): n= is, >> group_compat, endgrent, not found >> Mar =C2=A01 19:22:00 youcant cron[22627]: NSSWITCH(nss_method_lookup): n= is, >> passwd_compat, endpwent, not found >> Mar =C2=A01 19:22:00 youcant /usr/sbin/cron[22628]: (www) CMD (echo "Hel= lo") >> Mar =C2=A01 19:22:00 youcant cron[22628]: NSSWITCH(nss_method_lookup): n= is, >> group_compat, setgrent, not found >> Mar =C2=A01 19:22:00 youcant cron[22628]: NSSWITCH(nss_method_lookup): n= is, >> group_compat, endgrent, not found >> Mar =C2=A01 19:22:00 youcant cron[22628]: NSSWITCH(nss_method_lookup): n= is, >> passwd_compat, endpwent, not found >> Mar =C2=A01 19:22:00 youcant cron[22630]: NSSWITCH(nss_method_lookup): n= is, >> group_compat, setgrent, not found >> Mar =C2=A01 19:22:00 youcant cron[22630]: NSSWITCH(nss_method_lookup): n= is, >> group_compat, endgrent, not found >> Mar =C2=A01 19:22:00 youcant cron[22630]: NSSWITCH(nss_method_lookup): n= is, >> passwd_compat, endpwent, not found >> >> >> >> #### >> # /var/log/maillog >> #### >> Mar =C2=A01 19:22:00 youcant sendmail[22630]: n21JM0Gl022630: from=3Dwww= , >> size=3D0, class=3D0, nrcpts=3D0, >> msgid=3D<200903011922.n21JM0Gl022630@youcant.tastetherainbow.ws>, >> relay=3Dwww@localhost > > It looks like you're using user: www for your crontab. > > Unfortunately, from /etc/passwd: > > www:*:80:80:World Wide Web Owner:/nonexistent:/usr/sbin/nologin > > i.e user www can't do much without a shell. > > Create a crontab as a user with a shell, MAILTO to your gmail account. > > The user may want to be a member of a group with privileges. Or use > sudo. > > Don't forget to add him to /var/cron/allow as per manpage for > crontab(1). > > You could set SHELL in your crontab for www (might work) but I'd use a > different user who's a member of group operator maybe. > > Hope that helps. > > Regards, > > -- > > =C2=A0Frank > > > =C2=A0Contact info: http://www.shute.org.uk/misc/contact.html > > Thanks for the suggestions. The backup script I have in the crontab still runs perfectly fine - there's just no output. So cron itself is working, just not any email output. I'll try playing around with the MAILTO and the SHELL and such to try and get it working.
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?27ade5280903021540h2a4d9178vd0ec0a47c8124fb8>