📄 strss7.sh
字号:
#!/bin/sh## @(#) strss7.sh,v openss7-0_9_2_E(0.9.2.5) 2007/03/08 22:42:18# Copyright (c) 2001-2007 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.## These are arguments to update-rc.d ala chkconfig and lsb. They are recognized# by openss7 install_initd and remove_initd scripts. Each line specifies# arguments to add and remove links after the the name argument:## strss7: start and stop strss7 subsystem# update-rc.d: start 33 S . stop 33 0 6 .# config: /etc/default/strss7# probe: false# hide: false# license: GPL# description: This STREAMS 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 INFOPATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/binname='strss7'config="/etc/default/$name"desc="the STREAMS SS7 subsystem"mknod="${name}_mknod"[ -e /proc/modules ] || exit 0if test -z "$STRSS7_MKNOD" ; then for STRSS7_MKNOD in /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 config filefor file in $config ; do [ -f $file ] && . $filedone[ -z "$STRSS7_MKNOD" ] && STRSS7_MAKEDEVICES="no"[ -z "$STRSS7_MKNOD" ] && STRSS7_REMOVEDEVICES="no"RETVAL=0umask 077if [ "${VERBOSE:-0}" -eq 0 ] ; then redir='>/dev/null 2>&1'else redir=fibuild_options() { # Build up the options string :}start() { echo -n "Loading STREAMS kernel modules: " RETVAL=0 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 ! eval "grep '^$modrex\>' /proc/modules $redir" ; then echo -n "$module " eval "modprobe -k -q -- $module $redir" [ $? -eq 0 ] || echo -n "(failed)" fi done echo "." echo -n "Starting $desc: $name " build_options if [ $? -eq 0 ] ; then echo "." else echo "(failed.)" RETVAL=1 fi if eval "grep '^[[:space:]]*${name}[/.]' /etc/sysctl.conf $redir" ; then echo -n "Reconfiguring kernel parameters: " eval "sysctl -p /etc/sysctl.conf $redir" if [ $? -eq 0 ] ; then echo "." else echo "(failed.)" fi fi if [ -f /etc/${name}.conf ] ; then echo -n "Configuring STREAMS parameters: " eval "sysctl -p /etc/${name}.conf $redir" if [ $? -eq 0 ] ; then echo "." else echo "(failed.)" RETVAL=1 fi fi if [ -n "$STRSS7_MKNOD" -a ":$STRSS7_MAKEDEVICES" = ":yes" ] ; then echo -n "Making STREAMS SS7 devices: " $STRSS7_MKNOD if [ $? -eq 0 ] ; then echo "." else echo "(failed.)" RETVAL=1 fi fi return $RETVAL}stop() { echo "Stopping $desc: $name " RETVAL=0 if [ -n "$STRSS7_MKNOD" -a ":$STRSS7_REMOVEDEVICES" = ":yes" ] ; then echo -n "Removing STREAMS SS7 devices: " $STRSS7_MKNOD --remove if [ $? -eq 0 ] ; then echo "." else echo "(failed.)" RETVAL=1 fi fi echo -n "Unloading STREAMS kernel modules: " 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 eval "grep '^$modrex\>' /proc/modules $redir" ; then echo -n "$module " eval "modprobe -r -q -- $module $redir" if [ $? -ne 0 ] ; then echo -n "(failed) " RETVAL=1 fi fi done if [ $RETVAL -eq 0 ] ; then echo "." else echo "(failed.)" fi return $RETVAL}restart() { stop start return $?}show() { echo "$name.sh: show: not yet implemented." >&2 return 1}usage() { echo "Usage: /etc/init.d/$name.sh (start|stop|restart|force-reload|show)" >&2 return 1}case "$1" in (start|stop|restart|show) $1 || RETVAL=$? ;; (force-reload) restart || RETVAL=$? ;; (*) usage || RETVAL=$? ;;esac[ "${0##*/}" = "$name.sh" ] && exit $RETVAL# =============================================================================# # @(#) strss7.sh,v openss7-0_9_2_E(0.9.2.5) 2007/03/08 22:42:18## -----------------------------------------------------------------------------## Copyright (c) 2001-2007 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 2007/03/08 22:42:18 by brian## =============================================================================# vim: ft=sh sw=4 tw=80
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -