LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Software (https://www.linuxquestions.org/questions/linux-software-2/)
-   -   Fetchmail cannot start when i restart my server (https://www.linuxquestions.org/questions/linux-software-2/fetchmail-cannot-start-when-i-restart-my-server-756157/)

bjmakond 09-18-2009 06:32 AM

Fetchmail cannot start when i restart my server
 
Hi All,

I recently setup fetchmail on my server and its been running awesome! However, I noticed yesterday when the machine switched off due to a power cut, that fetchmail is having an error and will not start. Here is the error:

couldn't time-check the run-control file
fetchmail: lstat: /root/.fetchmailrc: Permission denied


However, when i start it manually thus: /usr/bin/fetchmail -f /root/.fetchmailrc, it works!

Any ideas?

Regards,

BJ

deadeyes 09-18-2009 07:40 AM

Quote:

Originally Posted by bjmakond (Post 3688360)
Hi All,

I recently setup fetchmail on my server and its been running awesome! However, I noticed yesterday when the machine switched off due to a power cut, that fetchmail is having an error and will not start. Here is the error:

couldn't time-check the run-control file
fetchmail: lstat: /root/.fetchmailrc: Permission denied


However, when i start it manually thus: /usr/bin/fetchmail -f /root/.fetchmailrc, it works!

Any ideas?

Regards,

BJ

If your distro starts, it uses the scripts in /etc/init.d
Maybe you can take a look there and see what line is causing this problem and debug it

bjmakond 09-18-2009 08:52 AM

Thanks for the reply deadeyes. however, i do not see anything to do with fetchmail in /etc/init.d directory

Regards,

BJ

deadeyes 09-19-2009 08:13 AM

Quote:

Originally Posted by bjmakond (Post 3688531)
Thanks for the reply deadeyes. however, i do not see anything to do with fetchmail in /etc/init.d directory

Regards,

BJ

what distribution are you using?

bjmakond 09-21-2009 01:05 AM

I am using CENTOS 5.3


Regards,
BJ

ak@shdubey 09-21-2009 01:41 AM

Quote:

Originally Posted by bjmakond (Post 3688360)
Hi All,

I recently setup fetchmail on my server and its been running awesome! However, I noticed yesterday when the machine switched off due to a power cut, that fetchmail is having an error and will not start. Here is the error:

couldn't time-check the run-control file
fetchmail: lstat: /root/.fetchmailrc: Permission denied


However, when i start it manually thus: /usr/bin/fetchmail -f /root/.fetchmailrc, it works!

Any ideas?

Regards,

BJ

Hi BJ ,

Based on error output it looks like issue is related with user/group permission, could you pls post '#ls -lrth' on fetchmailrc file.

kirukan 09-21-2009 01:47 AM

Quote:

#!/bin/sh
#
# fetchmail This shell script takes care of starting and stopping
# fetchmail.
#
# chkconfig: 2345 81 45
# description: The Fetchmail daemons allows to retrieve mail using
various
# mail protocols and route them to the local MTA just as if
# the mail was sent directly to the local MTA. This is
# specially useful on intermittent dial-up connections.
# processname: fetchmail
# config: /etc/fetchmailrc
# author[s]:
# Andrea Sterbini <a.sterbini@itelcad.it>
# ObiTuarY <obituary@freshmeat.net>

. /etc/rc.d/init.d/functions

# Source networking configuration.
. /etc/sysconfig/network

# Check that networking is up.
if [ ${NETWORKING} = "no" ]
then
exit 0
fi

# See how we were called.
case "$1" in
start)
if [ -s /etc/fetchmailrc ]; then
echo -n "Loading fetchmail: "
/usr/local/bin/fetchmail -d 900 -f /etc/fetchmailrc
echo
touch /var/lock/subsys/fetchmail
else
exit 1
fi
;;
stop)
echo -n "Shutting down fetchmail: "
/usr/bin/fetchmail -q >/dev/null 2>&1 && echo fetchmail
killproc fetchmail
rm -f /var/lock/subsys/fetchmail
;;
status)
status fetchmail
;;
restart|reload)
$0 stop
$0 start
;;
*)
echo "Usage: fetchmail {start|stop|status|restart|reload}"
exit 1
esac

exit 0
copy your /root/.fetchmailrc to /etc/fetchmailrc

bjmakond 09-21-2009 08:30 AM

I am a bit new to linux. what am i suppose to do with the above? sorry to be a bother. please may you explain a bit

Regards,
BJ

ak@shdubey 09-21-2009 02:56 PM

move fetchmailrc from /root to /etc folder
 
Quote:

Originally Posted by bjmakond (Post 3691647)
I am a bit new to linux. what am i suppose to do with the above? sorry to be a bother. please may you explain a bit

Regards,
BJ

What kirukan is trying to suggest is, since currently fetchmailrc file is in /root folder which will have permissions set to be executable only by root user, so once you move it back to /etc directory it should start automatically during system startup( provided it is owned by system user "mail" in this case )

in case if it is not owned by system user " mail" , you may execute
#chown mail:mail <path to fecthmailrc file>

Please give it a try


-Akash

deadeyes 09-22-2009 04:19 AM

Probably fetchmail runs not as a root user.
So the config should be /etc/fetchmailrc and should have user and group mail.
THen it will be started.
Otherwhise CentOS will try to start it. But it will fail with permission denied.

It probably runs if you start it yourself, when you are root.

bjmakond 09-22-2009 07:50 AM

Thanks very much guys. this did the trick! i just changed the location of my /root/.fetchmailrc file to /etc/fetchmailrc and its working! thanks for the help.

Regards,
BJ

deadeyes 09-23-2009 01:31 AM

Quote:

Originally Posted by bjmakond (Post 3692826)
Thanks very much guys. this did the trick! i just changed the location of my /root/.fetchmailrc file to /etc/fetchmailrc and its working! thanks for the help.

Regards,
BJ

In the thread tools above this page you can mark your topic as solved ;)


All times are GMT -5. The time now is 04:32 AM.