initial commit
This commit is contained in:
228
gloam_shell/device_config
Normal file
228
gloam_shell/device_config
Normal file
@@ -0,0 +1,228 @@
|
||||
#!/usr/bin/env python
|
||||
# -*- coding: UTF-8 -*-
|
||||
# created by zhangbin
|
||||
from sys import argv
|
||||
import json
|
||||
import os
|
||||
from pprint import pprint
|
||||
import shutil
|
||||
|
||||
def update_route(data):
|
||||
list = []
|
||||
route_path = '/etc/sysconfig/static-routes'
|
||||
requestOldParam = 'any net ' + data['destination_ip_old'] + ' netmask ' + data['ip_mask_old'] + ' gw ' + data['gateway_old'] + ' ' + \
|
||||
data['interface']
|
||||
result = os.popen(
|
||||
'route add -net ' + data['destination_ip'] + ' netmask ' + data['ip_mask'] + ' gw ' + data['gateway'] + ' ' +
|
||||
data['interface'])
|
||||
result2 = os.popen(
|
||||
'route del -net ' + data['destination_ip_old'] + ' netmask ' + data['ip_mask_old'] + ' gw ' + data['gateway_old'] + ' ' +
|
||||
data['interface'])
|
||||
# <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>쳣<EFBFBD><ECB3A3><EFBFBD><EFBFBD>ֹ<EFBFBD><D6B9><EFBFBD><EFBFBD>
|
||||
if (result != 0):
|
||||
print(result)
|
||||
return
|
||||
if (result2 != 0):
|
||||
print(result)
|
||||
return
|
||||
# <20><EFBFBD><DEB8><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ļ<EFBFBD><C4BC><EFBFBD><EFBFBD><EFBFBD>·<EFBFBD><C2B7><EFBFBD><EFBFBD>Ϣ
|
||||
with open(route_path, 'r+') as f_route:
|
||||
lines = f_route.readlines()
|
||||
for line in reversed(lines):
|
||||
if (requestOldParam in line):
|
||||
list.append('any net ' + data['destination_ip'] + ' netmask ' + data['ip_mask'] + ' gw ' + data['gateway'] + ' ' + \
|
||||
data['interface'] + '\n')
|
||||
else:
|
||||
list.append(line)
|
||||
f_route.seek(0)
|
||||
f_route.truncate()
|
||||
f_route.writelines(list)
|
||||
|
||||
|
||||
def new_route(data):
|
||||
# <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>·<EFBFBD><C2B7>
|
||||
result = os.popen(
|
||||
'route add -net ' + data['destination_ip'] + ' netmask ' + data['ip_mask'] + ' gw ' + data['gateway'] +' '+data['interface'])
|
||||
# <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>쳣<EFBFBD><ECB3A3><EFBFBD><EFBFBD>ֹ<EFBFBD><D6B9><EFBFBD><EFBFBD>
|
||||
if (result != 0):
|
||||
print(result)
|
||||
return
|
||||
route_path = '/etc/sysconfig/static-routes'
|
||||
# <20><><EFBFBD><EFBFBD>·<EFBFBD><C2B7><EFBFBD><EFBFBD>Ϣ<EFBFBD><CFA2><EFBFBD>ӵ<EFBFBD><D3B5>ļ<EFBFBD><C4BC><EFBFBD>
|
||||
result = os.path.exists(route_path)
|
||||
if (result == False):
|
||||
with open(route_path, 'w') as f:
|
||||
f.close()
|
||||
with open(route_path, 'r+') as f:
|
||||
strData = 'any net ' + data['destination_ip'] + ' netmask ' + data['ip_mask'] + ' gw ' + data['gateway'] + ' ' + \
|
||||
data['interface']
|
||||
f.seek(0, 2)
|
||||
f.write('\n' + strData)
|
||||
|
||||
|
||||
def remove_route(data):
|
||||
#ɾ<><C9BE>·<EFBFBD><C2B7><EFBFBD><EFBFBD>Ϣ
|
||||
route_path = '/etc/sysconfig/static-routes'
|
||||
list = []
|
||||
requestParam='any net ' + data['destination_ip'] + ' netmask ' + data['ip_mask'] + ' gw ' + data['gateway'] + ' ' + data['interface']
|
||||
result = os.popen(
|
||||
'route del -net ' + data['destination_ip'] + ' netmask ' + data['ip_mask'] + ' gw ' + data['gateway'] + ' ' +
|
||||
data['interface'])
|
||||
# <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>쳣<EFBFBD><ECB3A3><EFBFBD><EFBFBD>ֹ<EFBFBD><D6B9><EFBFBD><EFBFBD>
|
||||
if (result != 0):
|
||||
print(result)
|
||||
return
|
||||
with open(route_path, 'r+')as f_route:
|
||||
lines = f_route.readlines()
|
||||
for line in lines:
|
||||
if (not requestParam in line):
|
||||
list.append(line)
|
||||
f_route.seek(0)
|
||||
f_route.truncate()
|
||||
f_route.writelines(list)
|
||||
|
||||
|
||||
# <20><><EFBFBD><EFBFBD>ת<EFBFBD><D7AA>
|
||||
def exchange_maskint(mask_int):
|
||||
bin_arr = ['0' for i in range(32)]
|
||||
for i in range(mask_int):
|
||||
bin_arr[i] = '1'
|
||||
tmpmask = [''.join(bin_arr[i * 8:i * 8 + 8]) for i in range(4)]
|
||||
tmpmask = [str(int(tmpstr, 2)) for tmpstr in tmpmask]
|
||||
return '.'.join(tmpmask)
|
||||
|
||||
|
||||
# <20><>ȡ<EFBFBD><C8A1><EFBFBD><EFBFBD>·<EFBFBD>ɵ<EFBFBD><C9B5><EFBFBD>Ϣ
|
||||
def query_route():
|
||||
path = '/etc/sysconfig/static-routes'
|
||||
list = []
|
||||
if(os.path.exists(path)):
|
||||
with open(path, 'a+') as f:
|
||||
content=f.readlines()
|
||||
for i in content:
|
||||
if(not i.strip('\n')==''):
|
||||
data=i.split(' ')
|
||||
result = {}
|
||||
result['destination_ip'] = data[2]
|
||||
result['ip_mask'] = data[4]
|
||||
result['gateway'] = data[6]
|
||||
result['r_interface'] = data[7]
|
||||
if(result):
|
||||
list.append(result)
|
||||
return list
|
||||
|
||||
|
||||
# <20><>ȡ<EFBFBD><C8A1><EFBFBD><EFBFBD>·<EFBFBD>ɵ<EFBFBD><C9B5><EFBFBD>Ϣ
|
||||
def query_single_route(data): # <20><><EFBFBD><EFBFBD><EFBFBD>洢<EFBFBD><E6B4A2>list
|
||||
path = '/etc/sysconfig/network-scripts/route-'
|
||||
list = []
|
||||
with open(path + data, 'a+') as f:
|
||||
content = f.readline()
|
||||
a = content.split()
|
||||
b = a[0].split('/')
|
||||
result = {}
|
||||
result['destination_ip'] = b[0]
|
||||
result['ip_mask'] = exchange_maskint(int(b[1]))
|
||||
result['gateway'] = a[2]
|
||||
result['r_interface'] = a[4]
|
||||
if(result):
|
||||
list.append(result)
|
||||
return list
|
||||
|
||||
|
||||
# <20><>ȡ<EFBFBD><C8A1><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>õ<EFBFBD><C3B5><EFBFBD>Ϣ
|
||||
def query_all_config():
|
||||
path = '/etc/sysconfig/network-scripts/'
|
||||
list = []
|
||||
for file in os.listdir(path):
|
||||
if ('ifcfg-e' in file):
|
||||
with open(path + file, 'a+') as f:
|
||||
result = {}
|
||||
content = f.readline()
|
||||
while (content):
|
||||
res = content.split('=')
|
||||
result[res[0]] = res[1].rstrip('\n').rstrip()
|
||||
content = f.readline()
|
||||
if(result):
|
||||
list.append(result)
|
||||
return list
|
||||
'''
|
||||
def query_all_config():
|
||||
networknames=get_networkName()
|
||||
path = '/etc/sysconfig/network-scripts/ifcfg-'
|
||||
list = []
|
||||
for networkname in networknames:
|
||||
with open(path + networkname, 'a+') as f:
|
||||
result = {}
|
||||
content = f.readline()
|
||||
while (content):
|
||||
res = content.split('=')
|
||||
result[res[0]] = res[1].rstrip('\n').rstrip()
|
||||
content = f.readline()
|
||||
list.append(result)
|
||||
return list
|
||||
'''
|
||||
#<23><>ȡ<EFBFBD><C8A1><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
def get_networkName():
|
||||
result = os.popen("ifconfig | awk '/^[a-z]/{print $1}'").readlines()
|
||||
list = []
|
||||
for i in result:
|
||||
if ((i.strip("\n")).strip(":") == 'lo'):
|
||||
continue
|
||||
list.append((i.strip("\n")).strip(":"))
|
||||
return list
|
||||
|
||||
# <20><EFBFBD><DEB8><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϣ
|
||||
def modify_config(data):
|
||||
path = '/etc/sysconfig/network-scripts/'
|
||||
path2 = '/tmp/'
|
||||
# list<73><74>ΪN<CEAA><4E><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
list = data['request']
|
||||
for i in range(len(list)):
|
||||
dic = {}
|
||||
if (not (':' in list[i]['DEVICE'])):
|
||||
with open(path + 'ifcfg-' + list[i]['DEVICE'], 'r+') as f:
|
||||
for line in f:
|
||||
(key, value) = line.strip().split('=')
|
||||
dic[key] = value
|
||||
dic['HWADDR'] = list[i]['HWADDR']
|
||||
dic['NETMASK'] = list[i]['NETMASK']
|
||||
dic['GATEWAY'] = list[i]['GATEWAY']
|
||||
dic['IPADDR'] = list[i]['IPADDR']
|
||||
list2 = []
|
||||
for key in dic:
|
||||
list2.append(key + '=' + dic[key] + '\n')
|
||||
with open(path2 + 'ifcfg-' + list[i]['DEVICE'], 'w+') as f2:
|
||||
f2.writelines(list2)
|
||||
|
||||
if (os.path.exists(path + 'ifcfg-' + list[i]['DEVICE'])):
|
||||
os.remove(path + 'ifcfg-' + list[i]['DEVICE'])
|
||||
shutil.move(path2 + 'ifcfg-' + list[i]['DEVICE'], path)
|
||||
# <20><EFBFBD><DEB8><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϣ<EFBFBD><CFA2> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
os.popen('service network restart')
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
path_manage = '/etc/sysconfig/network-scripts/ifcfg-unknown2'
|
||||
data = json.loads(argv[1])[0]
|
||||
if data['type'] == '1':
|
||||
list=get_networkName()
|
||||
if(list):
|
||||
print(json.dumps(list))
|
||||
elif data['type'] == '2':
|
||||
update_route(data)
|
||||
elif data['type'] == '3':
|
||||
remove_route(data)
|
||||
elif data['type'] == '4':
|
||||
new_route(data)
|
||||
elif data['type'] == '5':
|
||||
list = query_route()
|
||||
if(list):
|
||||
print(json.dumps(list))
|
||||
elif data['type'] == '6':
|
||||
modify_config(data)
|
||||
elif data['type'] == '7':
|
||||
list = query_all_config()
|
||||
if(list):
|
||||
print(json.dumps(list))
|
||||
exit(0)
|
||||
197
gloam_shell/oam.sh
Normal file
197
gloam_shell/oam.sh
Normal file
@@ -0,0 +1,197 @@
|
||||
#!/bin/sh
|
||||
|
||||
# -----------------------------------------------------------------------------
|
||||
# Start/Stop Script for the DATACONTROLLER Server
|
||||
#
|
||||
# Environment Variable Prequisites
|
||||
#
|
||||
# DATACONTROLLER_HOME May point at your DATACONTROLLER "build" directory.
|
||||
# -----------------------------------------------------------------------------
|
||||
|
||||
# resolve links - $0 may be a softlink
|
||||
PRG="$0"
|
||||
|
||||
while [ -h "$PRG" ] ; do
|
||||
ls=`ls -ld "$PRG"`
|
||||
link=`expr "$ls" : '.*-> \(.*\)$'`
|
||||
if expr "$link" : '/.*' > /dev/null; then
|
||||
PRG="$link"
|
||||
else
|
||||
PRG=`dirname "$PRG"`/"$link"
|
||||
fi
|
||||
done
|
||||
|
||||
PRGDIR=`dirname "$PRG"`
|
||||
|
||||
# Only set DATACONTROLLER_HOME if not already set
|
||||
[ -z "$DATACONTROLLER_HOME" ] && DATACONTROLLER_HOME=`cd "$PRGDIR/.." ; pwd`
|
||||
cd "$DATACONTROLLER_HOME"/shell
|
||||
|
||||
if [ -z "$DATACONTROLLER_TMPDIR" ] ; then
|
||||
DATACONTROLLER_TMPDIR="$DATACONTROLLER_HOME"/temp
|
||||
fi
|
||||
if [ ! -d $DATACONTROLLER_TMPDIR ]
|
||||
then
|
||||
mkdir $DATACONTROLLER_TMPDIR
|
||||
fi
|
||||
|
||||
# -------- check jdk
|
||||
# check nmsjdk
|
||||
# NMS_HOME=`cd "$DATACONTROLLER_HOME/.." ; pwd`
|
||||
# cd "$DATACONTROLLER_HOME"/shell
|
||||
# NMS_JDK="$NMS_HOME"/nmsjdk
|
||||
# if [ ! -e "$NMS_JDK" ]
|
||||
# then
|
||||
# echo "$NMS_JDK not exist"
|
||||
# exit 0
|
||||
#fi
|
||||
# check java -version
|
||||
#javaversion=`$NMS_JDK/bin/java -version 2>&1|grep "java version"`
|
||||
#if [ ! -n "$javaversion" ]
|
||||
# then
|
||||
# echo "$NMS_JDK cannot use, please install"
|
||||
# exit 0
|
||||
#fi
|
||||
|
||||
# -------- set jdk path
|
||||
export JAVA_HOME=$DATACONTROLLER_HOME/jre1.8.0_181
|
||||
export CLASSPATH=$JAVA_HOME/lib/tools.jar:$JAVA_HOME/lib/dt.jar
|
||||
|
||||
|
||||
temp=$CLASSPATH
|
||||
#setting libs path
|
||||
libs="$DATACONTROLLER_HOME"/lib/*
|
||||
append(){
|
||||
temp=$temp":"$1
|
||||
}
|
||||
for file in $libs; do
|
||||
append $file
|
||||
done
|
||||
jars="$DATACONTROLLER_HOME"/bin/*
|
||||
for file in $jars; do
|
||||
append $file
|
||||
done
|
||||
export DC_CLASSPATH=$temp:.:$DATACONTROLLER_HOME/conf
|
||||
export LD_LIBRARY_PATH=$DATACONTROLLERT_HOME/lib
|
||||
export LANG=zh_CN.UTF-8
|
||||
|
||||
echo "Using DATACONTROLLER_HOME: $DATACONTROLLER_HOME"
|
||||
echo "Using DATACONTROLLER_TMPDIR: $DATACONTROLLER_TMPDIR"
|
||||
echo "Using JAVA_HOME: $JAVA_HOME"
|
||||
echo "Using CLASSPATH: $DC_CLASSPATH"
|
||||
|
||||
# ---- get jvm param
|
||||
jvmconf_file=$DATACONTROLLER_HOME"/conf/jvm.conf"
|
||||
if [ -f $jvmconf_file ]
|
||||
then
|
||||
XmsOpt=`sed -n '/-Xms/p' $jvmconf_file`
|
||||
XmxOpt=`sed -n '/-Xmx/p' $jvmconf_file`
|
||||
JAVA_OPTS="$XmsOpt $XmxOpt -XX:+UseParNewGC"
|
||||
else
|
||||
JAVA_OPTS="-Xms64m -Xmx256m -XX:+UseParNewGC"
|
||||
fi
|
||||
# <20><><EFBFBD><EFBFBD><EFBFBD>ij<DEB8><C4B3><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
program="com.nis.gloam.main.StartUp"
|
||||
name="gloam"
|
||||
|
||||
proc_id=
|
||||
|
||||
writePid()
|
||||
{
|
||||
ps aux|grep java|grep $program|grep -v grep|awk '{print $2}' > $DATACONTROLLER_TMPDIR/serverPid.temp
|
||||
}
|
||||
getPid()
|
||||
{
|
||||
unset proc_id
|
||||
proc_id=`ps aux|grep java|grep $program|grep -v grep|awk '{print $2}'`
|
||||
}
|
||||
|
||||
if [ "$1" = "start" ] ; then
|
||||
getPid
|
||||
if [ -n "$proc_id" ]
|
||||
then
|
||||
echo "$name already running......"
|
||||
else
|
||||
nohup $JAVA_HOME/bin/java $JAVA_OPTS -classpath $DC_CLASSPATH $program >./nohu.log 2>&1 &
|
||||
sleep 3
|
||||
getPid
|
||||
if [ -n "$proc_id" ]
|
||||
then
|
||||
echo "$name start success!!!!!"
|
||||
writePid
|
||||
else
|
||||
echo "$name start error!!!!!"
|
||||
fi
|
||||
fi
|
||||
elif [ "$1" = "stop" ]; then
|
||||
getPid
|
||||
if [ -n "$proc_id" ]
|
||||
then
|
||||
echo "$name is start, now kill......"
|
||||
kill -15 $proc_id
|
||||
sleep 3
|
||||
writePid
|
||||
echo "$name kill ok !!!!!!!!!!!!!"
|
||||
else
|
||||
echo "$name is not start!!!!!!!!!!!"
|
||||
fi
|
||||
elif [ "$1" = "restart" ] ; then
|
||||
getPid
|
||||
if [ -n "$proc_id" ]
|
||||
then
|
||||
echo "`date +%Y-%m-%d" "%H:%M:%S` :$name is start, now restart......" >> $DATACONTROLLER_TMPDIR/job.log
|
||||
count=1
|
||||
while [ $count -le 3 ]
|
||||
do
|
||||
sleep 1
|
||||
kill -15 $proc_id
|
||||
sleep 1
|
||||
getPid
|
||||
if [ -n "$proc_id" ]
|
||||
then
|
||||
echo "`date +%Y-%m-%d" "%H:%M:%S` :$name stop error!!!!!!!!!!" >> $DATACONTROLLER_TMPDIR/job.log
|
||||
else
|
||||
echo "`date +%Y-%m-%d" "%H:%M:%S` :$name stop success!!!!!!!!!!" >> $DATACONTROLLER_TMPDIR/job.log
|
||||
break
|
||||
fi
|
||||
count=$count+1
|
||||
done
|
||||
|
||||
getPid
|
||||
if [ -n "$proc_id" ]
|
||||
then
|
||||
sleep 1
|
||||
kill -9 $proc_id
|
||||
getPid
|
||||
if [ -n "$proc_id" ]
|
||||
then
|
||||
echo "`date +%Y-%m-%d" "%H:%M:%S` :$name stop -9 error!!!!!!!!!!" >> $DATACONTROLLER_TMPDIR/job.log
|
||||
exit 1
|
||||
fi
|
||||
fi
|
||||
|
||||
else
|
||||
echo "`date +%Y-%m-%d" "%H:%M:%S` :$name is not start, now start......" >> $DATACONTROLLER_TMPDIR/job.log
|
||||
fi
|
||||
|
||||
#--------copy right, start proc
|
||||
nohup $JAVA_HOME/bin/java $JAVA_OPTS -classpath $DC_CLASSPATH $program >/dev/null &
|
||||
sleep 3
|
||||
getPid
|
||||
if [ -n "$proc_id" ]
|
||||
then
|
||||
writePid
|
||||
echo "`date +%Y-%m-%d" "%H:%M:%S` :$name restart success!!!!!!!!!!" >> $DATACONTROLLER_TMPDIR/job.log
|
||||
else
|
||||
echo "`date +%Y-%m-%d" "%H:%M:%S` :$name restart error!!!!!!!!!!" >> $DATACONTROLLER_TMPDIR/job.log
|
||||
fi
|
||||
|
||||
else
|
||||
echo "Usage: oam.sh ( commands ... )"
|
||||
echo "commands:"
|
||||
echo " start Start $name"
|
||||
echo " stop Stop $name"
|
||||
echo " restart ReStart $name in a separate window"
|
||||
fi
|
||||
|
||||
cd -
|
||||
42
gloam_shell/remote_config
Normal file
42
gloam_shell/remote_config
Normal file
@@ -0,0 +1,42 @@
|
||||
#!/usr/bin/env python
|
||||
# -*- coding: UTF-8 -*-
|
||||
# created by tanghao
|
||||
from sys import argv
|
||||
import json
|
||||
import os
|
||||
import shutil
|
||||
|
||||
|
||||
def trans_list(data):
|
||||
result=''
|
||||
for i in range(len(data)):
|
||||
if(isinstance(data[i],dict)):
|
||||
result=trans_dic(data[i])
|
||||
return result
|
||||
|
||||
def trans_dic(data):
|
||||
count = len(data) - 1
|
||||
result='[{'
|
||||
for key in data:
|
||||
if (count == 0):
|
||||
if(isinstance(data[key],list)):
|
||||
methodResult=trans_list(data[key])
|
||||
result +='\\\"' + key + '\\\"' + ":" + methodResult
|
||||
elif(isinstance(data[key],dict)):
|
||||
methodResult =trans_dic(data[key])
|
||||
result += '\\\"' + key + '\\\"' + ":" + methodResult
|
||||
else:
|
||||
result += '\\\"' + key + '\\\"' + ":\\\"" + data[key] + "\\\""
|
||||
else:
|
||||
result += '\\\"' + key + '\\\"' + ":\\\"" + data[key] + "\\\","
|
||||
count = count - 1
|
||||
result+='}]'
|
||||
return result
|
||||
|
||||
if __name__ == '__main__':
|
||||
data = json.loads(argv[1])[0]
|
||||
ip=data['ip']
|
||||
jsonStr=trans_dic(data)
|
||||
result=os.system('ssh -o ConnectTimeout=3 '+ip+' \'device_config "'+jsonStr+'"\'')
|
||||
exit(0)
|
||||
|
||||
30
gloam_shell/restart.sh
Normal file
30
gloam_shell/restart.sh
Normal file
@@ -0,0 +1,30 @@
|
||||
#!/bin/sh
|
||||
|
||||
# -----------------------------------------------------------------------------
|
||||
# Retart Script for the DataController
|
||||
#
|
||||
# -----------------------------------------------------------------------------
|
||||
|
||||
# resolve links - $0 may be a softlink
|
||||
PRG="$0"
|
||||
|
||||
while [ -h "$PRG" ] ; do
|
||||
ls=`ls -ld "$PRG"`
|
||||
link=`expr "$ls" : '.*-> \(.*\)$'`
|
||||
if expr "$link" : '/.*' > /dev/null; then
|
||||
PRG="$link"
|
||||
else
|
||||
PRG=`dirname "$PRG"`/"$link"
|
||||
fi
|
||||
done
|
||||
|
||||
PRGDIR=`dirname "$PRG"`
|
||||
EXECUTABLE=oam.sh
|
||||
|
||||
if [ ! -x "$PRGDIR"/"$EXECUTABLE" ]; then
|
||||
echo "Cannot find $PRGDIR/$EXECUTABLE"
|
||||
echo "This file is needed to run this program"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
exec "$PRGDIR"/"$EXECUTABLE" restart "$@"
|
||||
30
gloam_shell/shutdown.sh
Normal file
30
gloam_shell/shutdown.sh
Normal file
@@ -0,0 +1,30 @@
|
||||
#!/bin/sh
|
||||
|
||||
# -----------------------------------------------------------------------------
|
||||
# Stop Script for the NMS Server
|
||||
#
|
||||
# -----------------------------------------------------------------------------
|
||||
|
||||
# resolve links - $0 may be a softlink
|
||||
PRG="$0"
|
||||
|
||||
while [ -h "$PRG" ] ; do
|
||||
ls=`ls -ld "$PRG"`
|
||||
link=`expr "$ls" : '.*-> \(.*\)$'`
|
||||
if expr "$link" : '/.*' > /dev/null; then
|
||||
PRG="$link"
|
||||
else
|
||||
PRG=`dirname "$PRG"`/"$link"
|
||||
fi
|
||||
done
|
||||
|
||||
PRGDIR=`dirname "$PRG"`
|
||||
EXECUTABLE=oam.sh
|
||||
|
||||
if [ ! -x "$PRGDIR"/"$EXECUTABLE" ]; then
|
||||
echo "Cannot find $PRGDIR/$EXECUTABLE"
|
||||
echo "This file is needed to run this program"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
exec "$PRGDIR"/"$EXECUTABLE" stop "$@"
|
||||
34
gloam_shell/startup.sh
Normal file
34
gloam_shell/startup.sh
Normal file
@@ -0,0 +1,34 @@
|
||||
#!/bin/sh
|
||||
|
||||
# -----------------------------------------------------------------------------
|
||||
# Start/Stop Script for the NMSSERVER Server
|
||||
#
|
||||
# Environment Variable Prequisites
|
||||
#
|
||||
# NMSSERVER_HOME May point at your NMSSERVER "build" directory.
|
||||
# -----------------------------------------------------------------------------
|
||||
|
||||
# resolve links - $0 may be a softlink
|
||||
PRG="$0"
|
||||
|
||||
while [ -h "$PRG" ] ; do
|
||||
ls=`ls -ld "$PRG"`
|
||||
link=`expr "$ls" : '.*-> \(.*\)$'`
|
||||
if expr "$link" : '/.*' > /dev/null; then
|
||||
PRG="$link"
|
||||
else
|
||||
PRG=`dirname "$PRG"`/"$link"
|
||||
fi
|
||||
done
|
||||
|
||||
PRGDIR=`dirname "$PRG"`
|
||||
|
||||
EXECUTABLE=oam.sh
|
||||
|
||||
if [ ! -x "$PRGDIR"/"$EXECUTABLE" ]; then
|
||||
echo "Cannot find $PRGDIR/$EXECUTABLE"
|
||||
echo "This file is needed to run this program"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
exec "$PRGDIR"/"$EXECUTABLE" start "$@"
|
||||
Reference in New Issue
Block a user