[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Install script supporting sysV init?
From: |
Danny Milosavljevic |
Subject: |
Re: Install script supporting sysV init? |
Date: |
Sun, 26 Jan 2020 23:38:20 +0100 |
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
pgpAbgOOJfv4Y.pgp
Description: OpenPGP digital signature
- Install script supporting sysV init?, Jan, 2020/01/26
- Re: Install script supporting sysV init?,
Danny Milosavljevic <=
- Re: Install script supporting sysV init?, Jan, 2020/01/27
- Re: Install script supporting sysV init?, Julien Lepiller, 2020/01/27
- Re: Install script supporting sysV init?, Jan, 2020/01/28
- Re: Install script supporting sysV init?, Danny Milosavljevic, 2020/01/28
- Re: Install script supporting sysV init?, Danny Milosavljevic, 2020/01/28
- Re: Install script supporting sysV init?, Jan, 2020/01/28
- Re: Install script supporting sysV init?, Danny Milosavljevic, 2020/01/28
- Re: Install script supporting sysV init?, Jan, 2020/01/28
- Re: Install script supporting sysV init?, Danny Milosavljevic, 2020/01/28
- Re: Install script supporting sysV init?, Jan, 2020/01/30