From owner-freebsd-ports@FreeBSD.ORG Tue Jun 17 23:56:39 2008 Return-Path: Delivered-To: freebsd-ports@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id BEB591065676 for ; Tue, 17 Jun 2008 23:56:39 +0000 (UTC) (envelope-from jdc@parodius.com) Received: from mx01.sc1.parodius.com (mx01.sc1.parodius.com [72.20.106.3]) by mx1.freebsd.org (Postfix) with ESMTP id A6F2C8FC19 for ; Tue, 17 Jun 2008 23:56:39 +0000 (UTC) (envelope-from jdc@parodius.com) Received: by mx01.sc1.parodius.com (Postfix, from userid 1000) id 9F1B21CC07A; Tue, 17 Jun 2008 16:56:39 -0700 (PDT) Date: Tue, 17 Jun 2008 16:56:39 -0700 From: Jeremy Chadwick To: Pietro Cerutti Message-ID: <20080617235639.GA33355@eos.sc1.parodius.com> References: <746214C8-3863-4B29-8B01-230579284C76@bitgravity.com> <4858428A.80502@FreeBSD.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <4858428A.80502@FreeBSD.org> User-Agent: Mutt/1.5.18 (2008-05-17) Cc: David Hawthorne , freebsd-ports@freebsd.org Subject: Re: Question about ports adding cronjobs X-BeenThere: freebsd-ports@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Porting software to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 17 Jun 2008 23:56:39 -0000 On Wed, Jun 18, 2008 at 01:02:34AM +0200, Pietro Cerutti wrote: > -----BEGIN PGP SIGNED MESSAGE----- > Hash: SHA512 > > David Hawthorne wrote: > | I have a piece of software I've been working on that gathers stats about > | the local host and shoves them into rrd files, with an accompanying web > | front-end page that generates pretty graphs from the RRDs on demand. I > | have a package done up for it, and I'd like to add it to the ports tree > | eventually, but I'm stuck on how to get it to automagically add the > | cronjob to have the stats gathering script run every five minutes, and I > | don't know of any ports that add cronjobs off the top of my head to go > | look at. > | > | Is there an approved standard for doing this? It doesn't have to be as > | root, either, it can run under a different user. Any advice on how to > | get the port to add the user (and remove it properly when the port is > | deinstalled) properly and securely would be appreciated as well. > > The only port which comes to my mind which goes near to what you want to > achieve is sysutils/bsdstats, which installs a script in periodic/monthly. > If running daily is enough you may want to look at that. > > Another option would be to create a support script/daemon and place it > in rc.d. The script/daemon would then sit idle and wake up once every > and gather your statistics. > > Third option: instruct the user (via a message at post-install stage) on > how to setup the cron job. Or a fourth option: do what mail/postfix does, and prompt you interactively during the install phase whether or not you want done to your system. In the case of mail/postfix, it prompts you to permit modification of /etc/mail/mailer.conf. Automatic modification of cronjobs, system files, etc. == generally shunned. I don't mind if the port asks me for permission to do such, but I do mind if it blindly starts modifying things on my system without my approval. -- | Jeremy Chadwick jdc at parodius.com | | Parodius Networking http://www.parodius.com/ | | UNIX Systems Administrator Mountain View, CA, USA | | Making life hard for others since 1977. PGP: 4BD6C0CB |