From 4ef14866295c1328a11f9a06cfc3bc1db9b1e7b6 Mon Sep 17 00:00:00 2001 From: Prasanna Kumar Kalever Date: Mon, 16 Jan 2017 17:54:23 +0530 Subject: gluster-blockd: add systemd unit file MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit starting gluster-blockd: $ make install $ systemctl daemon-reload $ systemctl start gluster-blockd.service checking status: $ systemctl status gluster-blockd.service ● gluster-blockd.service - Gluster block storage utility Loaded: loaded (gluster-blockd.service; disabled; vendor preset: disabled) Active: active (running) since Mon 01-16 17:53:23 IST; 3min 42s ago Main PID: 27552 (gluster-blockd) Tasks: 1 (limit: 512) CGroup: /system.slice/gluster-blockd.service └─27552 /usr/local/sbin/gluster-blockd Jan 16 17:53:23 local systemd[1]: Started Gluster block storage utility. gluster-blockd.service inturn brings below services: 1. rpcbind.service 2. target.service and 3. tcmu-runner.service In order. Signed-off-by: Prasanna Kumar Kalever --- Makefile | 13 ++++++++++--- systemd/gluster-blockd.service | 12 ++++++++++++ 2 files changed, 22 insertions(+), 3 deletions(-) create mode 100644 systemd/gluster-blockd.service diff --git a/Makefile b/Makefile index 1e911a0..5bce7b2 100644 --- a/Makefile +++ b/Makefile @@ -25,6 +25,9 @@ DEPS_LIST = gcc tcmu-runner targetcli PREFIX ?= /usr/local/sbin MKDIR_P = mkdir -p +INSTALL = /usr/bin/install -c +INSTALLDATA = /usr/bin/install -c -m 644 +SYSTEMD_DIR = /usr/lib/systemd/system LOGDIR = /var/log/ @@ -49,11 +52,15 @@ $(CLIENT).o: $(CLIENT).c $(CC) $(CFLAGS) -c $< -o $@ install: $(CLIENT) $(SERVER) - cp $^ $(PREFIX)/ + $(INSTALL) $^ $(PREFIX)/ + @if [ -d $(SYSTEMD_DIR) ]; then \ + $(MKDIR_P) $(SYSTEMD_DIR); \ + $(INSTALLDATA) systemd/$(SERVER).service $(SYSTEMD_DIR)/; \ + fi .PHONY: clean distclean clean distclean: - rm -f ./*.o ./rpc/*.o $(CLIENT) $(SERVER) + $(RM) ./*.o ./rpc/*.o $(CLIENT) $(SERVER) uninstall: - rm -f $(PREFIX)/$(CLIENT) $(PREFIX)/$(SERVER) + $(RM) $(PREFIX)/$(CLIENT) $(PREFIX)/$(SERVER) $(SYSTEMD_DIR)/$(SERVER).service diff --git a/systemd/gluster-blockd.service b/systemd/gluster-blockd.service new file mode 100644 index 0000000..d1fc67c --- /dev/null +++ b/systemd/gluster-blockd.service @@ -0,0 +1,12 @@ +[Unit] +Description=Gluster block storage utility +Requires=rpcbind.service target.service tcmu-runner.service +After=rpcbind.service target.service tcmu-runner.service + +[Service] +Type=simple +ExecStart=/usr/local/sbin/gluster-blockd +KillMode=process + +[Install] +WantedBy=multi-user.target -- cgit