Skip to content

Commit

Permalink
Enhancements for systemd (#11)
Browse files Browse the repository at this point in the history
* Removed SysV init scripts
* Adjusted service definition
* Modify daemonization for forking type of systemd service
  • Loading branch information
jariq committed Jul 25, 2018
1 parent 5d87d13 commit 75dd453
Show file tree
Hide file tree
Showing 7 changed files with 16 additions and 231 deletions.
9 changes: 5 additions & 4 deletions src/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -43,14 +43,15 @@ distclean: clean


install:
mkdir -p $(DESTDIR)/etc/init.d
mkdir -p $(DESTDIR)/etc
mkdir -p $(DESTDIR)/lib/systemd/system
mkdir -p $(DESTDIR)/usr/sbin
mkdir -p $(DESTDIR)/usr/share/man/man8
mkdir -p $(DESTDIR)/usr/share/man/man5
mkdir -p $(DESTDIR)/usr/share/man/man1
cp ipwatchd $(DESTDIR)/usr/sbin
cp scripts/ipwatchd-script $(DESTDIR)/usr/sbin
cp scripts/debian/ipwatchd $(DESTDIR)/etc/init.d
cp ipwatchd-script $(DESTDIR)/usr/sbin
cp ipwatchd.service $(DESTDIR)/lib/systemd/system
cp ipwatchd.conf $(DESTDIR)/etc
cp ../doc/ipwatchd.8.gz $(DESTDIR)/usr/share/man/man8
cp ../doc/ipwatchd.conf.5.gz $(DESTDIR)/usr/share/man/man5
Expand All @@ -59,7 +60,7 @@ install:
uninstall:
rm $(DESTDIR)/usr/sbin/ipwatchd
rm $(DESTDIR)/usr/sbin/ipwatchd-script
rm $(DESTDIR)/etc/init.d/ipwatchd
rm $(DESTDIR)/lib/systemd/system/ipwatchd.service
rm $(DESTDIR)/etc/ipwatchd.conf
rm $(DESTDIR)/usr/share/man/man8/ipwatchd.8.gz
rm $(DESTDIR)/usr/share/man/man5/ipwatchd.conf.5.gz
Expand Down
7 changes: 0 additions & 7 deletions src/daemonize.c
Original file line number Diff line number Diff line change
Expand Up @@ -41,13 +41,6 @@ int ipwd_daemonize (void)
return (IPWD_RV_ERROR);
}

/* If parent of this process is init we are already in daemon mode */
if (getppid () == 1)
{
ipwd_message (IPWD_MSG_TYPE_INFO, "Already running as daemon");
return (IPWD_RV_SUCCESS);
}

/* Fork child process */
pid_t pid = fork ();
if (pid < 0)
Expand Down
File renamed without changes.
11 changes: 11 additions & 0 deletions src/ipwatchd.service
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
[Unit]
Description=IP conflict detection daemon
Documentation=man:ipwatchd(8) man:ipwatchd.conf(5) man:ipwatchd-script(1)
After=network.target

[Service]
Type=forking
ExecStart=/usr/sbin/ipwatchd -c /etc/ipwatchd.conf

[Install]
WantedBy=multi-user.target
88 changes: 0 additions & 88 deletions src/scripts/centos/ipwatchd

This file was deleted.

117 changes: 0 additions & 117 deletions src/scripts/debian/ipwatchd

This file was deleted.

15 changes: 0 additions & 15 deletions src/scripts/fedora/ipwatchd.service

This file was deleted.

0 comments on commit 75dd453

Please sign in to comment.