From mboxrd@z Thu Jan 1 00:00:00 1970 From: Jan Subject: Re: Install script supporting sysV init? Date: Mon, 27 Jan 2020 17:09:20 +0100 Message-ID: <20200127170920.4ae3c415@kompiuter> References: <20200126230211.1d700a9e@kompiuter> <20200126233820.02fa4cd3@scratchpost.org> Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Return-path: Received: from eggs.gnu.org ([2001:470:142:3::10]:56636) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iw6xI-0005RY-HH for guix-devel@gnu.org; Mon, 27 Jan 2020 11:09:41 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1iw6xH-0005eI-BK for guix-devel@gnu.org; Mon, 27 Jan 2020 11:09:40 -0500 Received: from smtpo.poczta.interia.pl ([217.74.65.159]:35219) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1iw6xF-0005YG-I7 for guix-devel@gnu.org; Mon, 27 Jan 2020 11:09:39 -0500 In-Reply-To: <20200126233820.02fa4cd3@scratchpost.org> List-Id: "Development of GNU Guix and the GNU System distribution." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guix-devel-bounces+gcggd-guix-devel=m.gmane-mx.org@gnu.org Sender: "Guix-devel" To: Danny Milosavljevic Cc: guix-devel@gnu.org Thanks, this generally works, except this line: > GUIX_LOCPATH=/var/guix/profiles/per-user/root/guix-profile/lib/locale > -E LC_ALL=en_US.utf8 -p /var/lock/guix-daemon.pid guix-daemon While trying to start the daemon, daemonize complains about the path not being absolute. I changed "guix-daemon" to "/gnu/store/ncknl03pkmamrxg7q9nxi1rn1qhvwbi9-guix-1.0.1/bin/guix-daemon" and it worked, but it isn't the right solution I guess. What should I do? On Sun, 26 Jan 2020 23:38:20 +0100 Danny Milosavljevic wrote: > Hi Jan, > > > Does someone plan writing init script for Guix, so it will work on > > distributions using sysV init? There are still distributions not > > using systemd, for example Devuan and last time I checked, the > > install script doesn't support it. > > I'm all for supporting it, but I can't remember all the idiocracies > and I have no machine to test it on. > > That said, sysv init scripts are just shell scripts which support the > arguments "start", "status", "stop" and sometimes have an LSB header > specifying where to put the stuff (which runlevels are supposed to > have it). > > We would basically put the following file into /etc/init.d/guix-daemon > and make it executable: > > #!/bin/bash -e > ### BEGIN INIT INFO > # Provides: guix-daemon > # Required-Start: $remote_fs $syslog > # Required-Stop: $remote_fs $syslog > # Default-Start: 2 3 4 5 > # Default-Stop: 0 1 6 > # Short-Description: Guix build daemon > # Description: Provides a daemon that does builds for Guix > ### END INIT INFO > > case "$1" in > start) > daemonize -a -e /var/log/guix-daemon-stderr.log > -o /var/log/guix-daemon-stdout.log -E > GUIX_LOCPATH=/var/guix/profiles/per-user/root/guix-profile/lib/locale > -E LC_ALL=en_US.utf8 -p /var/lock/guix-daemon.pid guix-daemon > --build-users-group=guixbuild ;; stop) > pid="`cat /var/lock/guix-daemon.pid`" if [ ! -z "${pid}" ] then > kill "${pid}" > sleep 10 > kill -9 "${pid}" > fi > # TODO: Maybe remove /var/lock/guix-daemon.pid ? > ;; > status) > pid="`cat /var/lock/guix-daemon.pid`" > if [ ! -z "${pid}" ] > then > if ps "${pid}" > /dev/null 2> /dev/null > then > echo "running" > else > echo "stale pid file" > fi > else > echo "not running" > fi > ;; > *) > echo "Usage: $0 (start|stop|status)" > ;; > esac > > I think in order to actually install the service one does this: > > $ sudo update-rc.d guix-daemon defaults > $ sudo update-rc.d guix-daemon enable Jan Wielkiewicz