Changeset: af0bae3d0d44 for MonetDB URL: https://dev.monetdb.org/hg/MonetDB/rev/af0bae3d0d44 Modified Files: ChangeLog.Mar2025 tools/merovingian/daemon/config/monetdbd.service.in Branch: Mar2025 Log Message:
Make dbfarm configurable when using systemd and create automatically. Also, we have a check in place to check that the PID is written to the correct location since systemd depends on it. diffs (40 lines): diff --git a/ChangeLog.Mar2025 b/ChangeLog.Mar2025 --- a/ChangeLog.Mar2025 +++ b/ChangeLog.Mar2025 @@ -1,4 +1,9 @@ # ChangeLog file for devel # This file is updated with Maddlog +* Wed Aug 13 2025 Sjoerd Mullender <[email protected]> +- It is now relatively easy to configure the location of the database farm + (aka dbfarm) directory when using systemd. Just create an override + file for the monetdbd service and add an Environment entry for DBFARM + pointing to the new directory. diff --git a/tools/merovingian/daemon/config/monetdbd.service.in b/tools/merovingian/daemon/config/monetdbd.service.in --- a/tools/merovingian/daemon/config/monetdbd.service.in +++ b/tools/merovingian/daemon/config/monetdbd.service.in @@ -7,8 +7,21 @@ After=network.target Type=forking User=monetdb Group=monetdb -ExecStart=@CMAKE_INSTALL_FULL_BINDIR@/monetdbd-@MONETDB_VERSION@ start @CMAKE_INSTALL_FULL_LOCALSTATEDIR@/monetdb5/dbfarm -ExecStop=@CMAKE_INSTALL_FULL_BINDIR@/monetdbd-@MONETDB_VERSION@ stop @CMAKE_INSTALL_FULL_LOCALSTATEDIR@/monetdb5/dbfarm +UMask=0007 +# DBFARM is configurable by creating an override file in +# /etc/systemd/system/monetdbd.service.d (to be created) with content +# [Service] +# Environment=DBFARM=/some/other/directory +Environment=DBFARM=@CMAKE_INSTALL_FULL_LOCALSTATEDIR@/monetdb5/dbfarm +# create the dbfarm directory if it doesn't exist +ExecStartPre=/bin/bash -c 'test -d ${DBFARM} || (mkdir -m 770 ${DBFARM}; chcon -u system_u -r object_r -t mserver5_db_t ${DBFARM})' +# if no properties file, create one with correct pidfile, and set contexts +ExecStartPre=/bin/bash -c 'test -f ${DBFARM}/.merovingian_properties || (umask 0007; @CMAKE_INSTALL_FULL_BINDIR@/monetdbd-@MONETDB_VERSION@ create ${DBFARM}; @CMAKE_INSTALL_FULL_BINDIR@/monetdbd-@MONETDB_VERSION@ set pidfile=@CMAKE_INSTALL_FULL_RUNSTATEDIR@/monetdb/merovingian.pid ${DBFARM}; touch ${DBFARM}/.merovingian_lock; chcon -u system_u -r object_r -t monetdbd_lock_t ${DBFARM}/.merovingian_lock; chcon -u system_u -r object_r -t monetdbd_etc_t ${DBFARM}/.merovingian_properties)' +# make sure pidfile property is set correctly since systemd depends on it +ExecStartPre=/usr/bin/grep -q pidfile=@CMAKE_INSTALL_FULL_RUNSTATEDIR@/monetdb/merovingian.pid ${DBFARM}/.merovingian_properties +# start and stop the server +ExecStart=@CMAKE_INSTALL_FULL_BINDIR@/monetdbd-@MONETDB_VERSION@ start ${DBFARM} +ExecStop=@CMAKE_INSTALL_FULL_BINDIR@/monetdbd-@MONETDB_VERSION@ stop ${DBFARM} Restart=on-failure PIDFile=@CMAKE_INSTALL_FULL_RUNSTATEDIR@/monetdb/merovingian.pid PrivateDevices=no _______________________________________________ checkin-list mailing list -- [email protected] To unsubscribe send an email to [email protected]
