#!/bin/bash
#
# obs: Startup AhsayCBS (Ahsay Cloud Backup Suite) NFS Service
#
# chkconfig: 2345 95 95
#
### BEGIN INIT INFO
# Provides: cbsnfs
# Required-Start:    $remote_fs $local_fs $network
# Required-Stop:     $remote_fs $local_fs $network
# Default-Start:     2 3 4 5
# Default-Stop:      0 1 6
# Short-Description: Running AhsayCBS NFS Service on system startup
# Description:       Running AhsayCBS NFS Service on system startup
### END INIT INFO

# [Ahsay Cloud Backup Suite] (version 10.1.4.0)

CBSNFS_USER=@sed.user.name@
CBSNFS_UTIL_STARTUP=@sed.product.util.startup@
CBSNFS_UTIL_SHUTDOWN=@sed.product.util.shutdown@

# export CBSNFS_USER

case "$1" in
 start)
    echo ""
    echo "Starting up [ NFS Service (Ahsay Systems Corporation) ]"
    if [ root = ${CBSNFS_USER} ];
    then
      /bin/sh ${CBSNFS_UTIL_STARTUP}
    else
      su ${CBSNFS_USER} -c "/bin/sh ${CBSNFS_UTIL_STARTUP}"
    fi
    
    sleep 5
    echo "[ NFS Service (Ahsay Systems Corporation) ] is running"
    ;;

 stop)
    echo ""
    echo "Shutting down [ NFS Service (Ahsay Systems Corporation) ]"
    if [ root = ${CBSNFS_USER} ] ;
    then
      /bin/sh ${CBSNFS_UTIL_SHUTDOWN}
    else
      su ${CBSNFS_USER} -c "/bin/sh ${CBSNFS_UTIL_SHUTDOWN}"
    fi
    
    sleep 5
    echo "[ NFS Service (Ahsay Systems Corporation) ] is stopped"
    ;;

    *)
    echo $"usage: $0 {start|stop}";;
esac

