From owner-freebsd-questions@FreeBSD.ORG Mon Aug 24 20:45:22 2009 Return-Path: Delivered-To: freebsd-questions@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 781DE106568D for ; Mon, 24 Aug 2009 20:45:22 +0000 (UTC) (envelope-from jalmberg@identry.com) Received: from smtp-gw30.mailanyone.net (smtp-gw30.mailanyone.net [208.70.128.56]) by mx1.freebsd.org (Postfix) with ESMTP id 443AF8FC08 for ; Mon, 24 Aug 2009 20:45:22 +0000 (UTC) Received: from mailanyone.net by smtp-gw30.mailanyone.net with esmtpa (MailAnyone extSMTP jalmberg@identry.com) id 1MfgPm-0007ij-AB for freebsd-questions@freebsd.org; Mon, 24 Aug 2009 15:45:21 -0500 Mime-Version: 1.0 (Apple Message framework v753.1) Content-Transfer-Encoding: 7bit Message-Id: <87C694DA-8C7F-4DC2-A1B4-6C38542D14D9@identry.com> Content-Type: text/plain; charset=US-ASCII; delsp=yes; format=flowed To: freebsd-questions@freebsd.org From: John Almberg Date: Mon, 24 Aug 2009 16:45:16 -0400 X-Mailer: Apple Mail (2.753.1) Subject: Newbie discovers two useful apps... X-BeenThere: freebsd-questions@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: User questions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 24 Aug 2009 20:45:22 -0000 Even after a year or so of administering a number of FreeBSD servers, I still consider myself to be a newbie (see my various posts for evidence of this fact!) I've been hoping to have something useful to contribute back, and I suddenly realized there are probably newbies that are even newbier than I. Hard to believe, but true! You pros can flip to the next post, there's nothing here for you, but my fellow newbies may find this interesting... Anyway, this weekend I 'discovered' two VERY useful utilities: 1. The 'at' command: http://tinyurl.com/nzz5a9 I don't know about you, but I am constantly promising clients that something will happen at an odd hour of the day or night. A typical example is someone who wants some promotion to end at 7:30 am. Accomplishing this is pretty simple, but has required me to log into the server to manually execute some command, or write some tiny script and have it execute by cron in some tortured way. Super inconvenient, or a waste of time, or worse (if you forget). But this weekend I discovered the 'at' command. The man page gives you the details, but basically it allows you to say "execute that command or set of commands at this time on this day". You can set up the 'at' command to do what you need to do at 2am on Tuesday and forget it. No more setting alarms or forgetting. And it's dead easy to set up. I can't believe I haven't found this sooner. Fantastic. 2. DJB Daemontools: http://thedjbway.org/daemontools.html Lots of programs that are meant to run as daemons come packaged with a nice rc.d script. You just configure them in /etc/rc.d and they come up automatically when you reboot. But not all, and frankly I have never had time to figure out how to write a rc.d script. I really, really needed to get a linux-oriented daemon to work this weekend -- rubycas-server, if you are interested. But it doesn't have an rc.d script. Bummer. However, I run tinydns as my dns server, and that program doesn't use rc.d scripts, either. DJB has his own way of doing things, apparently. The standard way to install tinydns has you install another DJB product called daemontools. Daemontools is good for, well, getting daemons to run at boot time, in a fairly platform independent way (UNIX only, of course). Anyway, I dimly remembered this and dug into the DJB docs. Some will wonder why I found it easier to read a DJB doc than to read how to write a rc.d script... An excellent question, but in 5 minutes, I had my rubycas-server running under daemontools. It is that easy. I still don't know how to write an rc.d script, but I have to believe it would take me more than 5 minutes to learn and write. If you have daemons running, that you started manually from the command line, and are just hoping you'll remember to re-start them the next time you reboot, you should really check out daemontools... Much better than putting a reminder in your MOD (Me??? I would never do that!!!) -- John