Package: ptpd
Version: 2.3.1-debian1-4
Stopping ptpd takes about 30 seconds.
This:
# time systemctl stop ptpd
real 0m30.027s
user 0m0.003s
sys 0m0.003s
The /etc/init.d/ptpd is using the wrong lock file, so it uses the
timeout path of the ptpd bash script when invoking start-stop-daemon.
It should use /var/run/ptpd2.lock but it's currently checking
/var/run/ptpd.pid.
On my Ubuntu 22.04 system when ptpd is running I see:
# more /run/ptpd2.lock
1335821
# ps -ef | grep ptp
root 1335821 1 0 18:28 ? 00:00:00 /usr/sbin/ptpd
--interface=enp94s0f1np1 --config-file=/etc/ptpd2.conf
root 1336368 1314671 0 18:28 pts/0 00:00:00 grep --color=auto ptp
I tested using the patch below with Ubuntu 22.04 and with it in place
the stop takes less than a second, this:
# time systemctl stop ptpd
real 0m0.056s
user 0m0.005s
sys 0m0.000s
$ git diff
diff --git a/debian/ptpd.init b/debian/ptpd.init
index 47bbe25..7d70062 100755
--- a/debian/ptpd.init
+++ b/debian/ptpd.init
@@ -15,8 +15,9 @@
PATH=/sbin:/usr/sbin:/bin:/usr/bin
DESC="Precision Time Protocol daemon"
NAME=ptpd
+NAME2=ptpd2
DAEMON=/usr/sbin/$NAME
-PIDFILE=/var/run/$NAME.pid
+PIDFILE=/var/run/$NAME2.lock
SCRIPTNAME=/etc/init.d/$NAME
# Exit if the package is not installed