From mboxrd@z Thu Jan 1 00:00:00 1970 From: Danny Milosavljevic Subject: Re: Install script supporting sysV init? Date: Sun, 26 Jan 2020 23:38:20 +0100 Message-ID: <20200126233820.02fa4cd3@scratchpost.org> References: <20200126230211.1d700a9e@kompiuter> Mime-Version: 1.0 Content-Type: multipart/signed; boundary="Sig_/l9yE+V9+VVCdW6ZJJgGUOAy"; protocol="application/pgp-signature"; micalg=pgp-sha256 Return-path: Received: from eggs.gnu.org ([2001:470:142:3::10]:58365) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ivqY0-0002Mu-6f for guix-devel@gnu.org; Sun, 26 Jan 2020 17:38:29 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ivqXz-0007Oc-67 for guix-devel@gnu.org; Sun, 26 Jan 2020 17:38:28 -0500 Received: from dd26836.kasserver.com ([85.13.145.193]:43798) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1ivqXy-0007O4-W9 for guix-devel@gnu.org; Sun, 26 Jan 2020 17:38:27 -0500 In-Reply-To: <20200126230211.1d700a9e@kompiuter> 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: Jan Cc: guix-devel@gnu.org --Sig_/l9yE+V9+VVCdW6ZJJgGUOAy Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: quoted-printable 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 h= ave no machine to test it on. That said, sysv init scripts are just shell scripts which support the argum= ents "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-s= tdout.log -E GUIX_LOCPATH=3D/var/guix/profiles/per-user/root/guix-profile/l= ib/locale -E LC_ALL=3Den_US.utf8 -p /var/lock/guix-daemon.pid guix-daemon -= -build-users-group=3Dguixbuild ;; stop) pid=3D"`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=3D"`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 --Sig_/l9yE+V9+VVCdW6ZJJgGUOAy Content-Type: application/pgp-signature Content-Description: OpenPGP digital signature -----BEGIN PGP SIGNATURE----- iQEzBAEBCAAdFiEEds7GsXJ0tGXALbPZ5xo1VCwwuqUFAl4uFNwACgkQ5xo1VCww uqV87QgAhkOrA4R6Dk5y0qpe6eveHW6y1QxsRoBKUTVB7Ni6aRkeqcgUYPnNplZN r/g47lJgp6+5xQf9ZSXINqQm6XO0lwsC78G0G7+/2vKZgcNtFWj6a8FHRK/bP1dY lF55EYm7Uz73iM44u6+BnWtoSrFhEzw4VEUf+O3cUYIhwoiuC/IyYfS6ZO5smenQ NAFSY8D1OwiFBGMdCE9QU46I+H048G9YklFuawU4B9PODL02G8Ej3QbN9E7bkrke HxIymR8DTBhnaZtIJlmAL2WVaGujh7YsU3cBiRWEGnAK9hR5iVTNt5xMinJhAg+W u7IxettNPexgyCa3hdl8qushJh6l2g== =vbLJ -----END PGP SIGNATURE----- --Sig_/l9yE+V9+VVCdW6ZJJgGUOAy--