Browse Source

TT#40459 Move the rtpengine NFS mount point into its own sysvinit script

We detangle the two actions so that they can be performed independently
and on different conditions. This makes it possible to start the
rtpengine-recording-daemon only on the active node, and on some
role-specific nodes, while mounting the NFS filesystem in other
nodes.

We do not remove the nfs-setup start from the recording daemon init
script as sysvinit does not honor dependencies during direct init.d
or service(8) invocations.

[gjover@sipwise.com: Adapt changes to sysvinit. ]

Change-Id: Ibb637c533c94bc3db119111460ca647a50a205af
(cherry picked from commit 0224a49162)
changes/80/28780/5
Guillem Jover 8 years ago
parent
commit
8e5b338dee
4 changed files with 50 additions and 3 deletions
  1. +2
    -2
      debian/ngcp-rtpengine-recording-daemon.init
  2. +38
    -0
      debian/ngcp-rtpengine-recording-daemon.ngcp-rtpengine-recording-nfs-mount.init
  3. +6
    -1
      debian/ngcp-rtpengine-recording-nfs-setup
  4. +4
    -0
      debian/rules

+ 2
- 2
debian/ngcp-rtpengine-recording-daemon.init View File

@ -1,8 +1,8 @@
#! /bin/sh
### BEGIN INIT INFO
# Provides: ngcp-rtpengine-recording-daemon
# Required-Start: $network $local_fs $remote_fs $syslog
# Required-Stop: $network $local_fs $remote_fs $syslog
# Required-Start: $network $local_fs $remote_fs ngcp-rtpengine-recording-nfs-mount $syslog
# Required-Stop: $network $local_fs $remote_fs ngcp-rtpengine-recording-nfs-mount $syslog
# Should-Start: sshd
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6


+ 38
- 0
debian/ngcp-rtpengine-recording-daemon.ngcp-rtpengine-recording-nfs-mount.init View File

@ -0,0 +1,38 @@
#! /bin/sh
### BEGIN INIT INFO
# Provides: ngcp-rtpengine-recording-nfs-mount
# Required-Start: $remote_fs $local_fs $remote_fs $syslog
# Required-Stop: $remote_fs $local_fs $remote_fs $syslog
# Should-Start: sshd
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: NGCP RTP/media Recording NFS mount point
### END INIT INFO
set -e
. /lib/lsb/init-functions
###
case "$1" in
start)
ngcp-rtpengine-recording-nfs-setup start
;;
stop)
ngcp-rtpengine-recording-nfs-setup stop
;;
force-reload|restart)
$0 stop
$0 start
;;
status)
grep -E -q "^[^ :]+:[^ :]+ $NFS_LOCAL_MOUNT nfs.? " /proc/mounts
;;
*)
echo "Usage: $0 {start|stop|restart|force-reload|status}" >&2
exit 1
;;
esac
exit 0

+ 6
- 1
debian/ngcp-rtpengine-recording-nfs-setup View File

@ -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
- 0
debian/rules View File

@ -70,4 +70,8 @@ override_dh_install:
override_dh_strip:
dh_strip --dbg-package=ngcp-rtpengine-dbg
override_dh_installinit:
dh_installinit -pngcp-rtpengine-recording-daemon --name=ngcp-rtpengine-recording-nfs-mount
dh_installinit
override_dh_auto_test:

Loading…
Cancel
Save