LinuxQuestions.org
Review your favorite Linux distribution.
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 09-18-2009, 06:32 AM   #1
bjmakond
LQ Newbie
 
Registered: Jun 2009
Posts: 15

Rep: Reputation: 0
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
 
Old 09-18-2009, 07:40 AM   #2
deadeyes
Member
 
Registered: Aug 2006
Posts: 605

Rep: Reputation: 79
Quote:
Originally Posted by bjmakond View Post
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
 
Old 09-18-2009, 08:52 AM   #3
bjmakond
LQ Newbie
 
Registered: Jun 2009
Posts: 15

Original Poster
Rep: Reputation: 0
Thanks for the reply deadeyes. however, i do not see anything to do with fetchmail in /etc/init.d directory

Regards,

BJ
 
Old 09-19-2009, 08:13 AM   #4
deadeyes
Member
 
Registered: Aug 2006
Posts: 605

Rep: Reputation: 79
Quote:
Originally Posted by bjmakond View Post
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?
 
Old 09-21-2009, 01:05 AM   #5
bjmakond
LQ Newbie
 
Registered: Jun 2009
Posts: 15

Original Poster
Rep: Reputation: 0
I am using CENTOS 5.3


Regards,
BJ
 
Old 09-21-2009, 01:41 AM   #6
ak@shdubey
LQ Newbie
 
Registered: Sep 2009
Location: India
Distribution: Redhat/Oracle Ent/CentOS
Posts: 28
Blog Entries: 1

Rep: Reputation: 16
Quote:
Originally Posted by bjmakond View Post
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.
 
Old 09-21-2009, 01:47 AM   #7
kirukan
Senior Member
 
Registered: Jun 2008
Location: Eelam
Distribution: Redhat, Solaris, Suse
Posts: 1,230

Rep: Reputation: 132Reputation: 132
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
 
Old 09-21-2009, 08:30 AM   #8
bjmakond
LQ Newbie
 
Registered: Jun 2009
Posts: 15

Original Poster
Rep: Reputation: 0
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
 
Old 09-21-2009, 02:56 PM   #9
ak@shdubey
LQ Newbie
 
Registered: Sep 2009
Location: India
Distribution: Redhat/Oracle Ent/CentOS
Posts: 28
Blog Entries: 1

Rep: Reputation: 16
move fetchmailrc from /root to /etc folder

Quote:
Originally Posted by bjmakond View Post
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
 
Old 09-22-2009, 04:19 AM   #10
deadeyes
Member
 
Registered: Aug 2006
Posts: 605

Rep: Reputation: 79
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.
 
Old 09-22-2009, 07:50 AM   #11
bjmakond
LQ Newbie
 
Registered: Jun 2009
Posts: 15

Original Poster
Rep: Reputation: 0
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
 
Old 09-23-2009, 01:31 AM   #12
deadeyes
Member
 
Registered: Aug 2006
Posts: 605

Rep: Reputation: 79
Quote:
Originally Posted by bjmakond View Post
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
 
  


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
Start/Stop and Restart server by PHP Tomek58 Linux - Server 4 01-15-2009 09:47 AM
Xorg.conf is edited on restart? x-server fails to start Linkhiei Linux - Hardware 2 10-07-2007 10:49 AM
how can i start, stop or restart Paxmaster Slackware 3 11-27-2004 01:31 PM
Synaptic will not start after restart! Oh Cisco Debian 8 07-29-2004 11:44 AM
Samba - Start or Restart? Charlie Spencer Linux - Networking 5 11-22-2003 10:39 AM


All times are GMT -5. The time now is 06:42 AM.

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