diff --git a/debian/ngcp-rtpengine-recording-daemon.init b/debian/ngcp-rtpengine-recording-daemon.init index 92e6be99b..3bfe56d62 100755 --- a/debian/ngcp-rtpengine-recording-daemon.init +++ b/debian/ngcp-rtpengine-recording-daemon.init @@ -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 diff --git a/debian/ngcp-rtpengine-recording-daemon.ngcp-rtpengine-recording-nfs-mount.init b/debian/ngcp-rtpengine-recording-daemon.ngcp-rtpengine-recording-nfs-mount.init new file mode 100755 index 000000000..30c680383 --- /dev/null +++ b/debian/ngcp-rtpengine-recording-daemon.ngcp-rtpengine-recording-nfs-mount.init @@ -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 diff --git a/debian/ngcp-rtpengine-recording-nfs-setup b/debian/ngcp-rtpengine-recording-nfs-setup index 4b70ef0de..5a9fdef54 100755 --- a/debian/ngcp-rtpengine-recording-nfs-setup +++ b/debian/ngcp-rtpengine-recording-nfs-setup @@ -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 diff --git a/debian/rules b/debian/rules index cbcf64520..ee978dd2e 100755 --- a/debian/rules +++ b/debian/rules @@ -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: