From owner-freebsd-questions@FreeBSD.ORG Sat Feb 14 15:08:35 2004 Return-Path: Delivered-To: freebsd-questions@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id ED4C116A4CE for ; Sat, 14 Feb 2004 15:08:34 -0800 (PST) Received: from gateway.home.ricin.net (cp464173-a.dbsch1.nb.home.nl [212.204.145.167]) by mx1.FreeBSD.org (Postfix) with ESMTP id AEEA043D1F for ; Sat, 14 Feb 2004 15:08:34 -0800 (PST) (envelope-from danny@ricin.com) Received: from workstation.home.ricin.net (workstation.home.ricin.net [172.16.32.66]) by gateway.home.ricin.net (Postfix) with ESMTP id 48E4924D09; Sun, 15 Feb 2004 00:08:33 +0100 (CET) From: Danny Pansters To: FreeBSD Questions Date: Sun, 15 Feb 2004 00:08:32 +0100 User-Agent: KMail/1.6 References: <20040214004739.GD650@keyslapper.org> In-Reply-To: <20040214004739.GD650@keyslapper.org> MIME-Version: 1.0 Content-Disposition: inline Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit Message-Id: <200402150008.32838.danny@ricin.com> cc: Louis LeBlanc Subject: Re: startup daemon as unpriviliged user X-BeenThere: freebsd-questions@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list Reply-To: danny@ricin.com List-Id: User questions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 14 Feb 2004 23:08:35 -0000 On Saturday 14 February 2004 01:47, Louis LeBlanc wrote: > Hey everyone. Here's a general question for you. > > I have a FreeBSD 4.8 system that runs fetchmail for me as an > unprivileged everyday userid. The problem is that the machine isn't > on the most reliable powergrid one could hope for. > > So when the system comes back up after going down, I ALWAYS forget > that I have to get fetchmail restarted. If I forget for too long, > there's so much mail it blows the server that receives the mail into > oblivion (also FreeBSD 4.8, running Sendmail, Cyrus Imapd, and the > main culprit, Spamassassin - spamd). This is so bad that I often have > to reboot the receiving system. > > So, how can I get a process to run automatically on startup for an > unprivileged user? For a user unpriviledged but with a login, run service as user if available as an option to the app you want to run or use sudo or equivalent (as root you can sudo anything as any user). I have made this little blurb for my desktop after realizing that it's easy to forget starting spambayes pop3 proxy and then have my kmail be not able to connect to localhost:10110: % cat /usr/local/etc/rc.d/zzz_local_users.sh #!/bin/sh # spambayes cd /home/danny sudo -u danny sb_server.py -D hammie.db -l 10110 pop.vuurwerk.nl 110 & # get yahoo mail every n minutes sudo -u danny ./.fetchyahoo & It's a bit crude (need to hit enter to get my console back) but for my desktop its ok as it is. Obviously sudo needs to be installed and in path. The processes show up if I 'ps' as user danny and I can kill or hup them. HTH, Dan