Re: Troubles starting fetchmail from init scripts



On Fri, 2010-03-19 at 14:08 -0700, Jonathan Ryshpan wrote:
On Fri, 2010-03-19 at 15:02 -0500, Steven Stern wrote:
On 03/19/2010 02:52 PM, Jonathan Ryshpan wrote:
I have a little script to start fetchmail, which is activated in
rc.local. It runs perfectly when started from a root login; but it
fails when started from rc.local.

Here is the info:
=========================== Scripts Start ===========================
$ more rc.local fetchmail-start
::::::::::::::
rc.local
::::::::::::::
#!/bin/sh
#
# This script will be executed *after* all the other init scripts.
# You can put your own initialization stuff in here if you don't
# want to do the full Sys V style init stuff.

# Fork a script that will start fetchmail for jonrysh in a few seconds
/etc/rc.d/fetchmail-start

touch /var/lock/subsys/local
::::::::::::::
fetchmail-start
::::::::::::::
#!/bin/sh
#
# Start fetchmail for jonrysh

su jonrysh -c 'sleep 5; fetchmail'

=========================== Messages Start ===========================
Fetchmail emits the following error message and fails:
fetchmail: open: /home/jonrysh/.fetchmailrc: Permission denied

What's happening? How can it be fixed?

The perms on /home/jonrysh/.fetchmailrc need to be 600, with ownership
given to jonrysh:jonrysh

Everything is as you recommend. Note that the scheme works when invoked
from a command window running a shell as root, but not from the init
script.

You could also start it without the su by adding it to your own crontab:
@reboot sleep 30 & fetchmail

Thanks, I'll try this. But I'd still like to know what's the reason for
the permission failure when running out of rc.local . SELinux issues?

----
this works for me (in rc.local)...

/bin/su - craig -c '/usr/bin/fetchmail' &

Craig


--
This message has been scanned for viruses and
dangerous content by MailScanner, and is
believed to be clean.

--
users mailing list
users@xxxxxxxxxxxxxxxxxxxxxxx
To unsubscribe or change subscription options:
https://admin.fedoraproject.org/mailman/listinfo/users
Guidelines: http://fedoraproject.org/wiki/Mailing_list_guidelines



Relevant Pages

  • RE: configuring dial-up for extreme novices (i.e. Mom).
    ... I'm going to use userland ppp and postfix. ... > your Mom a script to run which will start fetchmail, ... Then have commands in script to kill fetchmail and user ... sudo /usr/sbin/ppp -quiet -background myisp ...
    (freebsd-questions)
  • Re: Troubles starting fetchmail from init scripts
    ... My startup script and configuration. ... # Start fetchmail for jonrysh ... echo "Configuration file not found " ...
    (Fedora)
  • Re: strange email behavior
    ... > different computer you use fetchmail to connect to the ... > poll your POP3 mailbox manually to debug your problem. ... I saw that the script was calling /etc/fetchmailrc, ... instead of my user's mbox. ...
    (RedHat)
  • Re: strange email behavior
    ... > startup script for fetchmail that might have something to do with it. ... Since running fetchmail as root is such an unbelievably bad idea that I ... the init script that you've got. ...
    (RedHat)
  • Re: Fetchmail revisited
    ... > fetchmail supports that. ... a script written by you rather than handing it to the MTA untouched. ... AND I did help the sorting a bit because at my ISP I'm allowed to ...
    (alt.os.linux.suse)