Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

icingadb initscript for non-systemd OS #281

Closed
wwuck opened this issue Mar 8, 2023 · 3 comments
Closed

icingadb initscript for non-systemd OS #281

wwuck opened this issue Mar 8, 2023 · 3 comments

Comments

@wwuck
Copy link

wwuck commented Mar 8, 2023

I have an icinga2 instance with icingaweb2 and monitoring module running on Devuan 4 (Debian 11 derivative without systemd) working successfully. I am attempting to install icingadb using the instructions at https://icinga.com/docs/icinga-db/latest/doc/02-Installation/03-Debian/ but the icingadb package only provides a systemd service file. I am using the icinga APT repository for all icinga related packages.

Can you please add a initscript /etc/init.d/icingadb for non-sytemd users? I can see that icingadb-redis-server already provides an initscript.

@wwuck
Copy link
Author

wwuck commented Mar 9, 2023

I have tested the following changes manually on my instance and it appears to be working ok. I'm not sure if there are better ways to be doing some of these, eg. log file.

/etc/init.d/icingadb copied and modified from /etc/init.d/icingadb-redis-server:

#! /bin/sh
### BEGIN INIT INFO
# Provides:		icingadb
# Required-Start:	$syslog $remote_fs
# Required-Stop:	$syslog $remote_fs
# Should-Start:		$local_fs
# Should-Stop:		$local_fs
# Default-Start:	2 3 4 5
# Default-Stop:		0 1 6
# Short-Description:	icingadb - Icinga configuration and state database
# Description:		icingadb - Icinga configuration and state database
### END INIT INFO


PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin
DAEMON=/usr/sbin/icingadb
DAEMON_ARGS="--config /etc/icingadb/config.yml"
LOGFILE=/var/log/icingadb/icingadb.log
NAME=icingadb
DESC=icingadb

RUNDIR=/run/icingadb
PIDFILE=$RUNDIR/icingadb.pid

test -x $DAEMON || exit 0

if [ -r /etc/default/$NAME ]
then
	. /etc/default/$NAME
fi

. /lib/lsb/init-functions

set -e

if [ "$(id -u)" != "0" ]
then
	log_failure_msg "Must be run as root."
	exit 1
fi

case "$1" in
  start)
	echo -n "Starting $DESC: "
	mkdir -p $RUNDIR
	touch $PIDFILE
	chown icingadb:icingadb $RUNDIR $PIDFILE
	chmod 755 $RUNDIR

	if [ -n "$ULIMIT" ]
	then
		ulimit -n $ULIMIT || true
	fi

	if start-stop-daemon --start --quiet --oknodo --umask 007 --pidfile $PIDFILE --make-pidfile --background --output $LOGFILE --chuid icingadb:icingadb --exec $DAEMON -- $DAEMON_ARGS
	then
		echo "$NAME."
	else
		echo "failed"
	fi
	;;
  stop)
	echo -n "Stopping $DESC: "

	if start-stop-daemon --stop --retry forever/TERM/1 --quiet --oknodo --pidfile $PIDFILE --remove-pidfile --exec $DAEMON
	then
		echo "$NAME."
	else
		echo "failed"
	fi
	rm -f $PIDFILE
	sleep 1
	;;

  restart|force-reload)
	${0} stop
	${0} start
	;;

  status)
	status_of_proc -p ${PIDFILE} ${DAEMON} ${NAME}
	;;

  *)
	echo "Usage: /etc/init.d/$NAME {start|stop|restart|force-reload|status}" >&2
	exit 1
	;;
esac

exit 0

/etc/logrotate.d/icingadb copied and modified from /etc/logrotate.d/icingadb-redis-server:

/var/log/icingadb/icingadb*.log {
        weekly
        missingok
        rotate 12
        compress
        notifempty
}

Also mkdir -p /var/log/icingadb and chown icingadb:adm /var/log/icingadb.

@htriem
Copy link
Contributor

htriem commented Mar 14, 2023

After consideration we've decided against adding an initscript to IcingaDB - we don't officially support any Linux distributions without systemd, and we don't have the capacity to properly maintain and test and give support for initscripts over a wide range of systems and Icinga modules.

Other initscripts in Icinga projects are there for legacy reasons; icingadb-redis-server does have one because its source provides one. We'd suggest using systemd with Icinga - you're obviously free to use your initscript in any way you'd want, but we can't provide support for it.

@htriem htriem closed this as completed Mar 14, 2023
@wwuck
Copy link
Author

wwuck commented Mar 15, 2023

Thanks for the information @htriem. I did look through all the website, docs, GitHub, etc. everywhere previously and I didn’t see it written anywhere that icinga has a requirement on systemd and that non-systemd is unsupported. Can you please point me to where I can find that?

non-systemd init systems (sysvinit, runit, openrc, s6, etc.) are still a supported configuration in Debian.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants