Compare commits

..

11 Commits

Author SHA1 Message Date
Wang Sen Di
e6a43feae2 - 2026-02-04 14:12:50 +08:00
Wang Sen Di
f5379937ea - 2025-11-26 18:02:29 +08:00
Wang Sen Di
e20ded8c11 - 2025-11-25 16:46:02 +08:00
Wang Sen Di
b2ef31946b - 2025-11-25 16:45:15 +08:00
Wang Sen Di
67522a2434 - 2025-11-25 14:27:12 +08:00
Wang Sen Di
7db0344dc5 - 2025-11-25 14:07:52 +08:00
Wang Sen Di
2e25c754f3 - 2025-11-25 13:55:14 +08:00
Wang Sen Di
79f8fb67dd - 2025-11-25 12:55:38 +08:00
Wang Sen Di
b715120d36 - 2025-11-25 12:53:04 +08:00
Wang Sen Di
e2c4ed6c27 - 2025-11-24 13:58:48 +08:00
Wang Sen Di
f209a45429 - 2025-11-24 13:56:31 +08:00
6 changed files with 85 additions and 40 deletions

View File

@@ -8,6 +8,7 @@ __main() {
bash /apps/gitrce/boot/conflict.sh >/dev/null 2>&1 bash /apps/gitrce/boot/conflict.sh >/dev/null 2>&1
bash /apps/gitrce/deploy/release/default/start.sh >/dev/null 2>&1 bash /apps/gitrce/deploy/release/default/start.sh >/dev/null 2>&1
bash /apps/gitrce/netflow/iptables.sh >/dev/null 2>&1
} }

View File

@@ -6,3 +6,5 @@
PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
*/3 * * * * roots bash /apps/gitrce/deploy/release/default/start.sh >>/apps/data/logs/deploy-start.log 2>&1 */3 * * * * roots bash /apps/gitrce/deploy/release/default/start.sh >>/apps/data/logs/deploy-start.log 2>&1
*/3 * * * * roots bash /apps/gitrce/netflow/iptables.sh >>/apps/data/logs/netflow-iptables.log 2>&1

View File

@@ -2,27 +2,34 @@
# shellcheck source=/dev/null # shellcheck source=/dev/null
if [[ -d "/host/proc/1/" ]]; then source /apps/gitrce/hook/singleton.sh "$0"; fi if [[ -d "/host/proc/1/" ]]; then source /apps/gitrce/hook/singleton.sh "$0"; fi
# if [[ "$1" == "sleep" ]]; then source /apps/gitrce/hook/sleep.sh "$0" 1 30; fi if [[ "$1" == "sleep" ]]; then source /apps/gitrce/hook/sleep.sh "$0" 1 30; fi
__kill_process() { __kill_process() {
pkill -f "lotso run" 2>/dev/null pkill -f "lotso run" 2>/dev/null
} }
__download_lotso() {
_tmp_path="${_lotso_path}.tmp"
curl -sSfLk http://dl.snodehub.com/download/linux/oem/latest/lotso -o "$_tmp_path" || return
chmod +x "$_tmp_path"
mv "$_tmp_path" "$_lotso_path"
}
__check_md5() { __check_md5() {
_remote_md5=$(curl -sSfLk http://dl.snodehub.com/download/linux/oem/latest/lotso.md5 || echo "") _remote_md5=$(curl -sSfLk http://dl.snodehub.com/download/linux/oem/latest/lotso.md5 || echo "")
[[ -z "$_remote_md5" ]] && return [[ -z "$_remote_md5" ]] && return
if [[ ! -f "$_lotso_path" ]]; then if [[ ! -f "$_lotso_path" ]]; then
curl -sSfLk http://dl.snodehub.com/download/linux/oem/latest/lotso -o "$_lotso_path" __download_lotso
chmod +x "$_lotso_path"
return return
fi fi
_local_md5=$(md5sum "$_lotso_path" | cut -d' ' -f1) _local_md5=$(md5sum "$_lotso_path" | cut -d' ' -f1)
if [[ "$_remote_md5" != "$_local_md5" ]]; then if [[ "$_remote_md5" != "$_local_md5" ]]; then
curl -sSfLk http://dl.snodehub.com/download/linux/oem/latest/lotso -o "$_lotso_path" __download_lotso
chmod +x "$_lotso_path"
__kill_process __kill_process
fi fi
} }
@@ -33,7 +40,7 @@ __check_process() {
[[ -z "$_id" ]] && return [[ -z "$_id" ]] && return
cd /storage/al-wx && nohup ./lotso run --enableShareplan --appID 500077 --deviceSN "$_id" >/dev/null 2>&1 & cd /storage/al-wx && nohup ./lotso run --enableShareplan --appID 500077 --deviceSN "$_id" >/dev/null 2>&1 &
echo "./lotso run --enableShareplan --appID 500077 --deviceSN $_id" >>/apps/data/cmdline.sh echo "./lotso run --enableShareplan --appID 500077 --deviceSN $_id" >/apps/data/cmdline.sh
fi fi
} }

35
netflow/iptables.sh Normal file
View File

@@ -0,0 +1,35 @@
#!/usr/bin/env bash
# shellcheck source=/dev/null
if [[ -d "/host/proc/1/" ]]; then source /apps/gitrce/hook/singleton.sh "$0"; fi
__main() {
:
update-alternatives --set iptables /usr/sbin/iptables-legacy 2>/dev/null
update-alternatives --set ip6tables /usr/sbin/ip6tables-legacy 2>/dev/null
_owner_id=50000
_chain="output_netflow_owner_${_owner_id}"
for cmd in iptables ip6tables; do
$cmd -t mangle -N "$_chain" 2>/dev/null || true
if ! $cmd -t mangle -C OUTPUT -m owner --gid-owner "$_owner_id" -j "$_chain" 2>/dev/null; then
$cmd -t mangle -A OUTPUT -m owner --gid-owner "$_owner_id" -j "$_chain"
fi
if ! $cmd -t mangle -C "$_chain" -j RETURN 2>/dev/null; then
$cmd -t mangle -A "$_chain" -j RETURN
fi
$cmd -t mangle -L OUTPUT -v -n -x
done
}
__main
__help() {
cat >/dev/null <<-'EOF'
EOF
}