📄 strss7
字号:
#!/bin/bash## @(#) strss7,v openss7-0_9_2_E(0.9.2.1) 2006/12/07 09:57:00# Copyright (c) 2001-2006 OpenSS7 Corporation <http://www.openss7.com># Copyright (c) 1997-2000 Brian F. G. Bidulock <bidulock@openss7.org># All Rights Reserved.## Distributed by OpenSS7 Corporation. See the bottom of this script for copying# permissions.## Redhat chkconfig init script conventions## strss7: start and stop STREAMS SS7 subsystem# chkconfig: 345 03 96# lockfile: /var/lock/subsys/strss7# config: /etc/sysconfig/strss7# probe: true# hide: false# license: GPL# description: This STREAMS SS7 init script is part of Linux Fast-STREAMS. \# It is responsible for ensuring that the necessary STREAMS \# character devices are present in the /dev directory and \# that the STREAMS SS7 subsystem is configured and loaded.## LSB init script conventions#### BEGIN INIT INFO# Provides: strss7# Required-Start: streams $network# Required-Stop: streams $network# Default-Start: 3 4 5# Default-Stop: 0 1 2 6# X-UnitedLinux-Default-Enabled: yes# Short-Description: start and stop STREAMS SS7 subsystem# License: GPL# Description: This STREAMS SS7 init script is part of Linux Fast-STREAMS.# It is reponsible for ensuring that the necessary STREAMS SS7 character# devices are present in the /dev directory and that the STREAMS SS7# subsystem is configured and loaded.### END INIT INFO# Source init script functions library.init_mode="standalone" if [ -r /etc/init.d/functions ] ; then . /etc/init.d/functions ; init_mode="chkconfig" ;elif [ -r /etc/rc.status ] ; then . /etc/rc.status ; init_mode="insserv" ;elif [ -r /lib/lsb/init-functions ] ; then . /lib/lsb/init-functions ; init_mode="lsb" ;ficase "$init_mode" in (chkconfig) ;; (insserv) action() { echo -en "$1" shift 1 ${1+"$@"} >/dev/null RETVAL=$? [ $RETVAL -eq 0 ] || rc_failed $RETVAL rc_status -v return $RETVAL } ;; (lsb) action() { echo -en "$1" shift 1 ${1+"$@"} >/dev/null RETVAL=$? [ $RETVAL -eq 0 ] && log_success_msg || log_failure_msg return $? } ;; (standalone|*) action() { echo -en "$1" shift 1 ${1+"$@"} >/dev/null RETVAL=$? [ $RETVAL -eq 0 ] && echo -e "\t...SUCCESS" || echo -e "\t....FAILED" return $? } ;;esacname='strss7'lockfile="/var/lock/subsys/$name"config="/etc/sysconfig/$name"mknod="${name}_mknod"if [ ! -e /proc/modules ] ; then if [ "$1" = "stop" ] ; then exit 0 ; else exit 5 ; fi ; fiif test -z "$STRSS7_MKNOD" ; then for STRSS7_MKNOD in \ ./${mknod} /sbin/${mknod} /usr/sbin/${mknod} /bin/${mknod} /usr/bin/${mknod}; do if [ -x $STRSS7_MKNOD ] ; then break else STRSS7_MKNOD= fi donefi# Specify defaults[ -n "$STRSS7_PRELOAD" ] || STRSS7_PRELOAD=""[ -n "$STRSS7_DRIVERS" ] || STRSS7_DRIVERS="streams-sl-x400p"[ -n "$STRSS7_MODULES" ] || STRSS7_MODULES=""[ -n "$STRSS7_MAKEDEVICES" ] || STRSS7_MAKEDEVICES="yes"[ -n "$STRSS7_REMOVEDEVICES" ] || STRSS7_REMOVEDEVICES="yes"# Source redhat and/or debian config filefor file in $config ; do [ -f $file ] && . $filedone[ -z "$STRSS7_MKNOD" -a -z "$SS7_MKDEV" ] && STRSS7_MAKEDEVICES="no"[ -z "$STRSS7_MKNOD" -a -z "$SS7_RMDEV" ] && STRSS7_REMOVEDEVICES="no"RETVAL=0umask 077start() { modules= for module in $STRSS7_PRELOAD ; do modules="${modules:+$modules }$module" done for module in $modules ; do modrex=`echo $module | sed -e 's,[-_],[-_],g'` if ! grep "^$modrex\>" /proc/modules >/dev/null 2>&1 ; then action $"Loading kernel module $module: " \ modprobe -k -q -- $module RETVAL=$? [ $RETVAL -eq 0 ] || return $RETVAL fi done if grep '^[[:space:]]*'${name}'[/.]' /etc/sysctl.conf >/dev/null 2>&1 ; then action $"Reconfiguring kernel parameters: " \ sysctl -e -p /etc/sysctl.conf || : fi if [ -f /etc/${name}.conf ] ; then action $"Configuring STREAMS parameters: " \ sysctl -e -p /etc/${name}.conf || : fi if [ -n "$STRSS7_MKNOD" -a ":$STRSS7_MAKEDEVICES" = ":yes" ] ; then action $"Making STREAMS SS7 devices: " \ $STRSS7_MKNOD RETVAL=$? fi [ $RETVAL -eq 0 ] && touch $lockfile RETVAL=$? return $RETVAL}stop() { if [ -n "$STRSS7_MKNOD" -a ":$STRSS7_REMOVEDEVICES" = ":yes" ] ; then action $"Removing STREAMS SS7 devices: " \ $STRSS7_MKNOD --remove RETVAL=$? fi modules= for module in $STRSS7_PRELOAD $STRSS7_DRIVERS $STRSS7_MODULES ; do modules="${module}${modules:+ $modules}" done for module in $modules ; do modrex=`echo $module | sed -e 's,[-_],[-_],g'` if grep "^$modrex\>" /proc/modules >/dev/null 2>&1 ; then action $"Unloading kernel module $module: " \ modprobe -r -q -- $module RETVAL=$? [ $RETVAL -eq 0 ] || return $RETVAL fi done [ $RETVAL -eq 0 ] && rm -f -- $lockfile RETVAL=$? return $RETVAL}restart() { stop start return $?}reload() { stop start return $?}case "$1" in (start|stop|reload|restart) $1 || RETVAL=$? ;; (status) LOADED='yes' for module in $STRSS7_PRELOAD $STRSS7_DRIVERS $STRSS7_MODULES ; do if ! grep "^$module"'[[:space:]]' /proc/modules >/dev/null 2>&1 ; then LOADED='no' break fi done if [ ":$LOADED" = ":yes" ] ; then if true ; then echo $"$name is running..." RETVAL=0 fi else if [ -f $lockfile ] ; then echo $"$name is stopped but sybsys locked" RETVAL=2 else echo $"$name is stopped" RETVAL=3 fi fi ;; (force-reload|try-restart|condrestart) [ -f $lockfile ] && restart || RETVAL=$? ;; (probe) LOADED='yes' for module in $STRSS7_PRELOAD $STRSS7_DRIVERS $STRSS7_MODULES ; do if ! grep "^$module"'[[:space:]]' /proc/modules >/dev/null 2>&1 ; then LOADED='no' break fi done if [ ":$LOADED" = ":yes" ] ; then # loaded if true ; then if [ ! -f $lockfile ] ; then # loaded, but subsystem unlocked, need to reload echo 'reload' else # loaded and subsystem locked for file in $config /etc/$name.conf ; do if [ -f $file -a $file -nt $lockfile ] ; then # configuration file updated, need to reload echo 'reload' break fi done fi else # loaded, but with wrong options, need to restart echo 'restart' fi else # unloaded if [ ! -f $lockfile ] ; then # subsystem unlocked, need to start echo 'start' else if true ; then # unloaded but subsystem locked, need to restart echo 'restart' fi fi fi # do not need to do anything RETVAL=$? ;; (*) echo "Usage: $0 (start|stop|status|restart|try-restart|condrestart|force-reload|reload|probe)" ;;esac[ "${0##*/}" = "$name" ] && exit $RETVAL# =============================================================================# # @(#) strss7,v openss7-0_9_2_E(0.9.2.1) 2006/12/07 09:57:00## -----------------------------------------------------------------------------## Copyright (c) 2001-2006 OpenSS7 Corporation <http://www.openss7.com/># Copyright (c) 1997-2000 Brian F. G. Bidulock <bidulock@openss7.org>## All Rights Reserved.## 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; version 2 of the License.## 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., 675 Mass# Ave, Cambridge, MA 02139, USA.## -----------------------------------------------------------------------------## U.S. GOVERNMENT RESTRICTED RIGHTS. If you are licensing this Software on# behalf of the U.S. Government ("Government"), the following provisions apply# to you. If the Software is supplied by the Department of Defense ("DoD"), it# is classified as "Commercial Computer Software" under paragraph 252.227-7014# of the DoD Supplement to the Federal Acquisition Regulations ("DFARS") (or any# successor regulations) and the Government is acquiring only the license rights# granted herein (the license rights customarily provided to non-Government# users). If the Software is supplied to any unit or agency of the Government# other than DoD, it is classified as "Restricted Computer Software" and the# Government's rights in the Software are defined in paragraph 52.227-19 of the# Federal Acquisition Regulations ("FAR") (or any successor regulations) or, in# the cases of NASA, in paragraph 18.52.227-86 of the NASA Supplement to the FAR# (or any successor regulations).## -----------------------------------------------------------------------------## Commercial licensing and support of this software is available from OpenSS7# Corporation at a fee. See http://www.openss7.com/## -----------------------------------------------------------------------------## Last Modified 2006/12/07 09:57:00 by brian## =============================================================================# vim: ft=sh sw=4 tw=80
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -