From owner-freebsd-questions@freebsd.org Sat Jan 30 19:35:30 2016 Return-Path: Delivered-To: freebsd-questions@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id A35C6A7276D for ; Sat, 30 Jan 2016 19:35:30 +0000 (UTC) (envelope-from freebsd@edvax.de) Received: from mx01.qsc.de (mx01.qsc.de [213.148.129.14]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 63991233 for ; Sat, 30 Jan 2016 19:35:29 +0000 (UTC) (envelope-from freebsd@edvax.de) Received: from r56.edvax.de (port-92-195-115-239.dynamic.qsc.de [92.195.115.239]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by mx01.qsc.de (Postfix) with ESMTPS id 9FB013D3A5; Sat, 30 Jan 2016 20:35:26 +0100 (CET) Received: from r56.edvax.de (localhost [127.0.0.1]) by r56.edvax.de (8.14.5/8.14.5) with SMTP id u0UJZPmq002097; Sat, 30 Jan 2016 20:35:25 +0100 (CET) (envelope-from freebsd@edvax.de) Date: Sat, 30 Jan 2016 20:35:25 +0100 From: Polytropon To: roberthuff@rcn.com Cc: freebsd-questions@freebsd.org Subject: Re: "epilogue" script? Message-Id: <20160130203525.261a0619.freebsd@edvax.de> In-Reply-To: <22188.61368.149775.620206@jerusalem.litteratus.org> References: <17145.128.135.52.6.1454106907.squirrel@cosmo.uchicago.edu> <20160130115955.ce9409ad.freebsd@edvax.de> <22188.61368.149775.620206@jerusalem.litteratus.org> Reply-To: Polytropon Organization: EDVAX X-Mailer: Sylpheed 3.1.1 (GTK+ 2.24.5; i386-portbld-freebsd8.2) Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-BeenThere: freebsd-questions@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: User questions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 30 Jan 2016 19:35:30 -0000 On Sat, 30 Jan 2016 12:15:36 -0500, roberthuff@rcn.com wrote: > > Polytropon writes: > > > b) rc.local and rc.shutdown.local > > > > Those files, located in /etc, are "real" shell scripts that will > > be executed "quite late", but not at the lastest possible > > point. Here is an example: > > > > Creating and/or trimming log files. > > Starting syslogd. > > No core dumps found. > > Additional ABI support: linux. > > Starting named. > > Clearing /tmp (X related). > > Starting local daemons: activity. <--- /etc/rc.local runnung now! > > Starting ntpd. > > Starting dhcpd. > > Starting cupsd. > > Configuring syscons: keymap keyrate font8x16 font8x14 font8x8. > > Starting sshd. > > Starting cron. > > Starting inetd. > > > > As you can see, there are other services started _after_ rc.local > > has been run. This might cause a problem for you when you need > > those services running. > > Since this indicates when things are started, as opposed to > when they take effect, it implies dropping (e.g.) "sleep 20" either > at the beginning of rc.local or a carefully chosen points therein > might cause stuff to happen when desired. > Crude ... but often effective. Hey, it's not _that_ bad - I did worse! For a client worksation with a crappy inkpee printer that often tended to stop working, I wrote a script that forcedly emptied the printer queue and re-enabled + re-accepted the printer (lprm, cupsenable, cupsaccept), so whenever the system was booted, the printer would be set to "normal". But as you can see: This did not work, as CUPS was started _after_ rc.local. Well... I decided to put those commands into the user's login shell script, but that was not executed - as he used Gnome + gdm, and _no_ initialization scripts were being honored (no .xinitrc, .xsession, .login etc.). So I ended up adding a Gnome custom "startup app" to that user's desktop session configuration. When I'm near that particular system again, I'll do the "sleep trick" with rc.local. :-) -- Polytropon Magdeburg, Germany Happy FreeBSD user since 4.0 Andra moi ennepe, Mousa, ...