sa_sample
来自「Pegasus is an open-source implementation」· 代码 · 共 111 行
TXT
111 行
#!/bin/bash#/*****************************************************************************# * Description: sample shell script to run SA in daemon mode# *# * Originated: May 16, 2003# * Original Author: Mike Day md@soft-hackle.net# * mdday@us.ibm.com# *# * $Header: /cvs/MSB/pegasus/src/slp/slp_client/scripts/sa_sample,v 1.1 2003/12/17 18:05:31 tony Exp $ # * # * Copyright (c) 2003 IBM # * Copyright (c) 2003 Michael Day # * # * Permission is hereby granted, free of charge, to any person obtaining a # * copy of this software and associated documentation files (the "Software"),# * to deal in the Software without restriction, including without limitation # * the rights to use, copy, modify, merge, publish, distribute, sublicense, # * and/or sell copies of the Software, and to permit persons to whom the # * Software is furnished to do so, subject to the following conditions: # * # * The above copyright notice and this permission notice shall be included in # * all copies or substantial portions of the Software.# * # * # * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR# * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,# * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL# * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER# * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING# * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER# * DEALINGS IN THE SOFTWARE.# *# *****************************************************************************/## command line syntax for sa_srvreg## slp_srvreg -- transmit an SLP Service Registration and print the results.# -------------------------------------------------------------------------# slp_srvreg --type=service-type-string# --url=url-string# --attributes=attribute-string# [--address=target-IP]# [--port=target-port]# [--scopes=scope-string]# [--lifetime=seconds]# [--interface=host-IP]# [--daemon=true]# [--use_da=true]# [--test]# [--spi=security-parameters-index] (not used)# All parameters must be a single string containing no spaces.# Always use the format of <parameter>=<value>.# Parameters enclosed in brackets are not optional.# number of urls we construct - translates into number of service advertsnum_urls=0 # array to hold each service:url urls[1]=""# service type string service="service:nothing:"# protocol part of the urlprotocol_part="//"# path part of the url path_part="/etc/nothing;version=1"# attribute string attributes="(version=1)"# collect all the ip interfaces on this host# rely on formatting of the linux ifconfig command. # this is a dirty hackIP_ADDRS=`/sbin/ifconfig | awk '/addr:/ {print $2}' | sed 's/addr://g'`# if slp_srvreg is already running in daemon mode, kill itkillall slp_srvreg# loop on each ip address and use it to construct a service:url for arg in $IP_ADDRS ; do let num_urls="$num_urls + 1" urls[$num_urls]=$service temp_string=${urls[$num_urls]}${protocol_part} urls[$num_urls]=${temp_string}${arg}${path_part} echo ${urls[$num_urls]} if [ "$num_urls" -eq "1" ] then slp_srvreg --type="$service" \ --url=${urls[$num_urls]} \ --attributes="$attributes" \ --daemon=true \ --address="127.0.0.1" & else slp_srvreg --type="$service" \ --url=${urls[$num_urls]} \ --attributes="(version=2),(vendor=IBM)" \ --address="127.0.0.1" fidone
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?