openwrt: mipsle build and service

This commit is contained in:
oycol 2021-11-06 05:03:09 +08:00
parent a042f3ddc4
commit f5bc70be3a
2 changed files with 47 additions and 0 deletions

View file

@ -39,6 +39,7 @@ jobs:
env GOOS=linux GOARCH=arm GOARM=6 go build -o build/netclient-arm6/netclient main.go
env GOOS=linux GOARCH=arm GOARM=7 go build -o build/netclient-arm7/netclient main.go
env GOOS=linux GOARCH=arm64 go build -o build/netclient-arm64/netclient main.go
env GOOS=linux GOARCH=mipsle go build -ldflags "-s -w" -o build/netclient-mipsle/netclient main.go && upx build/netclient-mipsle/netclient
- name: Upload x86 to Release
uses: svenstaro/upload-release-action@v2
@ -89,3 +90,13 @@ jobs:
overwrite: true
prerelease: true
asset_name: netclient-arm64
- name: Upload mipsle to Release
uses: svenstaro/upload-release-action@v2
with:
repo_token: ${{ secrets.GITHUB_TOKEN }}
file: netclient/build/netclient-mipsle/netclient
tag: ${{ env.NETMAKER_VERSION }}
overwrite: true
prerelease: true
asset_name: netclient-mipsle

36
scripts/openwrt-daemon.sh Normal file
View file

@ -0,0 +1,36 @@
#!/bin/bash /etc/rc.common
# Copyright (C) 2007 OpenWrt.org
EXTRA_COMMANDS="status"
EXTRA_HELP=" status Check service is running"
START=99
LOG_FILE="/tmp/netclient.logs"
start() {
local PIDS=($(ps -ef|grep "netclient checkin -n all"|grep -v grep|awk '{print $1}'))
if [ $PIDS ];then
echo "service is running"
return
fi
bash -c "while [ 1 ]; do /etc/netclient/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 PIDS=($(ps -ef|grep "netclient checkin -n all"|grep -v grep|awk '{print $1}'))
for i in "${PIDS[@]}"; do
kill $i
done
echo "stop"
}
status() {
local PIDS=($(ps -ef|grep "netclient checkin -n all"|grep -v grep|awk '{print $1}'))
if [ $PIDS ];then
echo -e "netclient[$PIDS] is running \n"
else
echo -e "netclient is not running \n"
fi
}