Discussion:
[Linuxptp-devel] [PATCH RFC] create systemd service script for ptp4l
Jacob Keller
2013-07-12 23:45:40 UTC
Permalink
This patch adds a systemd service unit for ptp4l. Currently does not allow
systemd to create any sockets, as this becomes really tricky since there are so
many types of configuration. The initial systemd service will be kept very
simple.:wq

Signed-off-by: Jacob Keller <***@intel.com>
---
makefile | 14 ++++++++++++--
ptp4l.8 | 7 +++++++
2 files changed, 19 insertions(+), 2 deletions(-)

diff --git a/makefile b/makefile
index 71dcf0c..96cb0b7 100644
--- a/makefile
+++ b/makefile
@@ -28,6 +28,7 @@ INC = -I$(KBUILD_OUTPUT)/usr/include
VER = -DVER=$(version)
CFLAGS = -Wall $(VER) $(INC) $(DEBUG) $(FEAT_CFLAGS) $(EXTRA_CFLAGS)
LDLIBS = -lm -lrt $(EXTRA_LDFLAGS)
+SRV = ptp4l.service
PRG = ptp4l pmc phc2sys hwstamp_ctl
OBJ = bmc.o clock.o clockadj.o config.o fault.o fsm.o ptp4l.o mave.o \
msg.o phc.o pi.o port.o print.o raw.o servo.o sk.o stats.o tlv.o tmtab.o \
@@ -43,9 +44,16 @@ VPATH = $(srcdir)
prefix = /usr/local
sbindir = $(prefix)/sbin
mandir = $(prefix)/man
+etcdir = $(prefix)/etc
man8dir = $(mandir)/man8
+srvdir = /lib/systemd/system/

-all: $(PRG)
+all: $(PRG) $(SRV)
+
+ptp4l.service: ptp4l.service.in
+ cat $(<) | sed \
+ -e 's_@@sbindir@@_$(sbindir)_g' \
+ -e 's_@@etcdir@@_$(etcdir)_g' >$(@)

ptp4l: $(OBJ)

@@ -70,10 +78,12 @@ force:
install: $(PRG)
mkdir -p $(sbindir) $(man8dir)
install $(PRG) $(sbindir)
+ install -p -m 644 $(SRV) $(srvdir)
install -p -m 644 -t $(man8dir) $(PRG:%=%.8)
+ cp default.cfg $(etcdir)/ptp4l.cfg

clean:
- rm -f $(OBJECTS) $(DEPEND)
+ rm -f $(OBJECTS) $(DEPEND) $(SRV)

distclean: clean
rm -f $(PRG)
diff --git a/ptp4l.8 b/ptp4l.8
index 6f42c1c..2f14b5a 100644
--- a/ptp4l.8
+++ b/ptp4l.8
@@ -395,6 +395,13 @@ of local clock in use. The value is purely informational, having no
effect on the outcome of the Best Master Clock algorithm, and is
advertised when the clock becomes grand master.

+.SH SYSTEMD SERVICE FILE
+
+.B ptp4l.service
+is a systemd service file for use with the systemd init system. This service
+file can be used with systemd and its utilities to manage the ptp4l daemon
+process.
+
.SH TIME SCALE USAGE

.B ptp4l
Keller, Jacob E
2013-07-12 23:46:52 UTC
Permalink
Ignore this, I forgot to add the actual ptp4l.service.in file.

- Jake
-----Original Message-----
Sent: Friday, July 12, 2013 4:46 PM
Subject: [Linuxptp-devel] [PATCH RFC] create systemd service script for
ptp4l
This patch adds a systemd service unit for ptp4l. Currently does not allow
systemd to create any sockets, as this becomes really tricky since there are so
many types of configuration. The initial systemd service will be kept very
simple.:wq
---
makefile | 14 ++++++++++++--
ptp4l.8 | 7 +++++++
2 files changed, 19 insertions(+), 2 deletions(-)
diff --git a/makefile b/makefile
index 71dcf0c..96cb0b7 100644
--- a/makefile
+++ b/makefile
@@ -28,6 +28,7 @@ INC = -I$(KBUILD_OUTPUT)/usr/include
VER = -DVER=$(version)
CFLAGS = -Wall $(VER) $(INC) $(DEBUG) $(FEAT_CFLAGS)
$(EXTRA_CFLAGS)
LDLIBS = -lm -lrt $(EXTRA_LDFLAGS)
+SRV = ptp4l.service
PRG = ptp4l pmc phc2sys hwstamp_ctl
OBJ = bmc.o clock.o clockadj.o config.o fault.o fsm.o ptp4l.o mave.o \
msg.o phc.o pi.o port.o print.o raw.o servo.o sk.o stats.o tlv.o tmtab.o \
@@ -43,9 +44,16 @@ VPATH = $(srcdir)
prefix = /usr/local
sbindir = $(prefix)/sbin
mandir = $(prefix)/man
+etcdir = $(prefix)/etc
man8dir = $(mandir)/man8
+srvdir = /lib/systemd/system/
-all: $(PRG)
+all: $(PRG) $(SRV)
+
+ptp4l.service: ptp4l.service.in
+ cat $(<) | sed \
ptp4l: $(OBJ)
install: $(PRG)
mkdir -p $(sbindir) $(man8dir)
install $(PRG) $(sbindir)
+ install -p -m 644 $(SRV) $(srvdir)
install -p -m 644 -t $(man8dir) $(PRG:%=%.8)
+ cp default.cfg $(etcdir)/ptp4l.cfg
- rm -f $(OBJECTS) $(DEPEND)
+ rm -f $(OBJECTS) $(DEPEND) $(SRV)
distclean: clean
rm -f $(PRG)
diff --git a/ptp4l.8 b/ptp4l.8
index 6f42c1c..2f14b5a 100644
--- a/ptp4l.8
+++ b/ptp4l.8
@@ -395,6 +395,13 @@ of local clock in use. The value is purely informational, having no
effect on the outcome of the Best Master Clock algorithm, and is
advertised when the clock becomes grand master.
+.SH SYSTEMD SERVICE FILE
+
+.B ptp4l.service
+is a systemd service file for use with the systemd init system. This service
+file can be used with systemd and its utilities to manage the ptp4l daemon
+process.
+
.SH TIME SCALE USAGE
.B ptp4l
------------------------------------------------------------------------------
See everything from the browser to the database with AppDynamics
Get end-to-end visibility with application monitoring from AppDynamics
Isolate bottlenecks and diagnose root cause in seconds.
Start your free trial of AppDynamics Pro today!
http://pubads.g.doubleclick.net/gampad/clk?id=48808831&iu=/4140/os
tg.clktrk
_______________________________________________
Linuxptp-devel mailing list
https://lists.sourceforge.net/lists/listinfo/linuxptp-devel
Loading...