[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: Running fetchmail at login time



Here are the scripts that I use (modified from the
ones in the contrib directory of the fetchmail distro)

~/.bash_profile
	#	Start Fetchmail up when I Login.
	#	 - modified from script in contrib section
	#	 - 1/24/01 Vinod Kurup vkurup@massmed.org

	TDEV=`tty | sed -n -e "s#/dev/##p"`

	if [ ! -s ~/.fetchmail.pid ]; then
		echo -n "Starting fetchmail daemon..."
		fetchmail -d 300
		echo $TDEV > ~/.fetchmail.owner
		echo "done."
	fi
	# END of Fetchmail startup

~/.bash_logout
	#	Below is for Fetchmail clean up
	#	 - modified from logout script in contrib section
	#	 - 1/24/01 Vinod Kurup vkurup@massmed.org

	TDEV=`tty | sed -n -e "s#/dev/##p"`
	
	if [ -s ~/.fetchmail.pid ]; then
		if [ -s ~/.fetchmail.owner ]; then
			OWNER=`cat ~/.fetchmail.owner`

			if [ $TDEV = $OWNER ]; then
				rm -rf ~/.fetchmail.owner
				fetchmail -q >/dev/null 2>&1
			fi
		fi
	fi
	# END of Fetchmail clean up


HTH,

Vinod

On Wed, Jan 24, 2001 at 08:18:03AM -0500, Brad Burns wrote:
> Have you checked fetchmails homepage?  I remember seeing a FAQ or something there describing how to do this.  The gist of it revolved around creating/removing temporary files using ~/.bash_profile and ~/.bash_logout using a specific file mask, ~/.bash_logout would look for other files, and if only one existed, would terminate fetchmail on its way out... hmm, looking at the fetchmail faq, it says the script that does this, is in the contrib directory in the fetchmail distribution, so you may need to download it yourself.
> 
> On Wed, Jan 24, 2001 at 09:22:41AM +0100 or thereabouts, Daniel de los Reyes wrote:
> > I want to run fetchmail as a daemon each time I log in but I don't want to do it manually.Is bash_profile the apropiate place to launch it from? How can I prevent it form being launched several times if I login at several consoles?
> > 
> > Thank's
> > 
> > -- 
> > ______________________________
> > Daniel de los Reyes
> > S2-Selling Soluciones
> > Valencia Spain
> > e-mail: dadecal@s2-selling.com
> > Powered by Debian GNU-Linux 2.2r2
> > ______________________________
> > 
> > 
> > -- 
> > To UNSUBSCRIBE, email to debian-user-request@lists.debian.org 
> > with a subject of "unsubscribe". Trouble? Contact listmaster@lists.debian.org
> > 
> 
> -- 
> 
> --* Brad Burns *--
> Fortune of the Minute:
> 
> To a Californian, the basic difference between the people and the pigeons
> in New York is that the pigeons don't shit on each other.
> 	-- From "East vs. West: The War Between the Coasts



-- 
_____________________________
Vinod Kurup, MD
email: vkurup@massmed.org
phone: 617.277.2012
cell:  617.359.5990
http://www.medicalrecords.com



Reply to: