mirror of
https://github.com/Ysurac/openmptcprouter-feeds.git
synced 2025-03-09 15:40:03 +00:00
add netmasker
This commit is contained in:
parent
d155e9a8ad
commit
ea3e086b1d
5 changed files with 431 additions and 0 deletions
42
netmaker-openwrt/netmaker/root/etc/init.d/netclient
Normal file
42
netmaker-openwrt/netmaker/root/etc/init.d/netclient
Normal file
|
@ -0,0 +1,42 @@
|
|||
#!/bin/sh /etc/rc.common
|
||||
#Created by oycol<oycol527@outlook.com>
|
||||
|
||||
EXTRA_COMMANDS="status"
|
||||
EXTRA_HELP=" status Check service is running"
|
||||
START=99
|
||||
|
||||
LOG_FILE="/tmp/netclient.logs"
|
||||
|
||||
start() {
|
||||
mkdir -p /etc/netclient/config
|
||||
mkdir -p /etc/systemd/system
|
||||
|
||||
if [ ! -f "${LOG_FILE}" ];then
|
||||
touch "${LOG_FILE}"
|
||||
fi
|
||||
local PID=$(ps|grep "netclient checkin -n all"|grep -v grep|awk '{print $1}')
|
||||
if [ "${PID}" ];then
|
||||
echo "service is running"
|
||||
return
|
||||
fi
|
||||
/bin/sh -c "while [ 1 ]; do netclient checkin -n all >> ${LOG_FILE} 2>&1;sleep 15;\
|
||||
if [ $(ls -l ${LOG_FILE}|awk '{print $5}') -gt 10240000 ];then tar zcf "${LOG_FILE}.tar" -C / "tmp/netclient.logs" && > $LOG_FILE;fi;done &"
|
||||
echo "start"
|
||||
}
|
||||
|
||||
stop() {
|
||||
local PID=$(ps|grep "netclient checkin -n all"|grep -v grep|awk '{print $1}')
|
||||
if [ "${PID}" ];then
|
||||
kill "${PID}"
|
||||
fi
|
||||
echo "stop"
|
||||
}
|
||||
|
||||
status() {
|
||||
local PID=$(ps|grep "netclient checkin -n all"|grep -v grep|awk '{print $1}')
|
||||
if [ "${PID}" ];then
|
||||
echo -e "netclient[${PID}] is running \n"
|
||||
else
|
||||
echo -e "netclient is not running \n"
|
||||
fi
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue