TT#40459 Move the rtpengine NFS mount point into its own systemd unit

We do not use a proper mount unit because that requires the mount point
to be encoded in the filename which is variable and depends on the value
coming from config.yml.

Change-Id: Ibb637c533c94bc3db119111460ca647a50a205af
changes/26/22826/6
Guillem Jover 7 years ago
parent f91b64fcdf
commit 0224a49162

@ -0,0 +1,20 @@
[Unit]
Description=NGCP RTP/media Recording Daemon NFS mount point
After=network-online.target
After=remote-fs.target
After=rpcbind.socket
After=rpcbind.service
After=nfs-client.target
Requires=network-online.target
Requires=rpcbind.socket
Requires=rpcbind.service
Requires=nfs-client.target
[Service]
Type=oneshot
RemainAfterExit=yes
ExecStart=/usr/sbin/ngcp-rtpengine-recording-nfs-setup start
ExecStop=/usr/sbin/ngcp-rtpengine-recording-nfs-setup stop
[Install]
WantedBy=multi-user.target

@ -2,12 +2,13 @@
Description=NGCP RTP/media Recording Daemon
After=network-online.target
After=remote-fs.target
After=ngcp-rtpengine-recording-nfs-mount.service
Requires=network-online.target
Requires=ngcp-rtpengine-recording-nfs-mount.service
[Service]
Type=simple
PIDFile=/run/ngcp-rtpengine-recording-daemon.pid
ExecStartPre=/usr/sbin/ngcp-rtpengine-recording-nfs-setup start
ExecStart=/usr/sbin/rtpengine-recording -f -E --pidfile /run/ngcp-rtpengine-recording-daemon.pid --config-file /etc/rtpengine/rtpengine-recording.conf
[Install]

@ -4,6 +4,7 @@ set -e
PATH=/sbin:/bin:/usr/sbin:/usr/bin
DEFAULTS=/etc/default/ngcp-rtpengine-recording-daemon
DESC="RTP engine recording NFS share"
. /lib/lsb/init-functions
@ -20,13 +21,17 @@ case "$1" in
start)
if [ "$MUST_NFS" = yes ]; then
if ! grep -E -q "^[^ :]+:[^ :]+ $NFS_LOCAL_MOUNT nfs.? " /proc/mounts; then
log_action_msg "Mounting NFS share"
log_action_msg "Mounting $DESC"
test -d "$NFS_LOCAL_MOUNT" || mkdir -p "$NFS_LOCAL_MOUNT"
mount -t nfs -o "$NFS_OPTIONS" "$NFS_HOST:$NFS_REMOTE_PATH" "$NFS_LOCAL_MOUNT"
fi
fi
;;
stop)
if grep -E -q "^[^ :]+:[^ :]+ $NFS_LOCAL_MOUNT nfs.? " /proc/mounts; then
log_action_msg "Unmounting $DESC"
umount "$NFS_LOCAL_MOUNT"
fi
;;
*)
echo "Usage: $0 {start|stop}" >&2

4
debian/rules vendored

@ -70,4 +70,8 @@ override_dh_install:
override_dh_strip:
dh_strip --dbgsym-migration='ngcp-rtpengine-dbg (<= 6.0.0.0+0~mr6.0.0.0)'
override_dh_systemd_enable:
dh_systemd_enable
dh_systemd_enable -pngcp-rtpengine-recording-daemon --name=ngcp-rtpengine-recording-nfs-mount
override_dh_auto_test:

Loading…
Cancel
Save