ACC SHELL

Path : /etc/sysconfig/network/scripts/
File Upload :
Current File : //etc/sysconfig/network/scripts/cifs

#! /bin/bash
#
# This program is free software; you can redistribute it and/or modify it under
# the terms of the GNU General Public License as published by the Free Software
# Foundation; either version 2 of the License, or (at your option) any later
# version.
#
# This program is distributed in the hope that it will be useful, but WITHOUT
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
# FOR A PARTICULAR PURPOSE.  See the GNU General Public License for more
# details.
#
# You should have received a copy of the GNU General Public License along with
# this program; if not, write to the Free Software Foundation, Inc., 59 Temple
# Place, Suite 330, Boston, MA 02111-1307 USA
#
# Author: Andreas Schneider <anschneider@suse.de>

# cifs
#
# Script to restart cifs

unset ${!LC_*} LANGUAGE
export LANG="POSIX"
export PATH="/sbin:/usr/sbin:/bin/:/usr/bin"

numArgs=$#
configname="$1"
shift
interface="$1"
if [ $interface = "lo" ]; then
  exit 0
fi
shift
# And shift away the '-o'.
shift
options="$@"

# Log functions
function log_dbg()
{
  	case "${options}" in
		*debug*)
			logger -t $0 -p daemon.debug "$1"
			;;
	esac
}
function log_err()
{
	logger -t $0 -p daemon.err "$1"
	exit 1
}

source /etc/rc.status

# Main case switch
case "$0" in
	*if-up.d*)
		. /etc/sysconfig/network/scripts/functions
		state=`read_cached_config_data dhcp4_state "$interface"`

		if rc_active nmb; then
			log_msg=$( rcnmb start 2>&1)
			log_dbg "${log_msg}"
		fi
		# Restart cifs only if IPaddress changes and cifs is active
		if [ "$state" == "new" ] && rc_active cifs; then
			log_msg=$( rccifs restart 2>&1)
			log_dbg "${log_msg}"
		fi
		;;
	*if-down.d*)
		if rc_active cifs; then
			log_msg=$( rccifs stop 2>&1)
			log_dbg "${log_msg}"
		fi
		;;
	*)
		log_err "Don't know what to do.  This script used to be called from dir if-{up,down}.d/."
		;;
esac

ACC SHELL 2018