first commit

This commit is contained in:
Vincent Hanewinkel
2025-05-21 16:47:43 +02:00
commit 0a84c90257
3 changed files with 97 additions and 0 deletions
+39
View File
@@ -0,0 +1,39 @@
#!/bin/sh /etc/rc.common
USE_PROCD=1
START=99
STOP=01
NAME=sshinternet
DEPENDS="network"
start_service() {
procd_open_instance
procd_set_param command /usr/bin/python3 /etc/openwrt_scripts/internet.py
procd_set_param respawn
procd_set_param env HOME=/root
procd_set_param stdout 1
procd_set_param stderr 1
procd_set_param user root
procd_set_param pidfile /var/run/${NAME}.pid
procd_close_instance
}
stop_service() {
pid=$(cat /var/run/${NAME}.pid 2>/dev/null)
[ -n "$pid" ] && {
logger -t "$NAME" "Stopping PID $pid"
kill $pid
timeout=10
while kill -0 $pid 2>/dev/null && [ $timeout -gt 0 ]; do
sleep 1
timeout=$((timeout-1))
done
[ $timeout -eq 0 ] && kill -9 $pid 2>/dev/null
}
rm -f /var/run/${NAME}.pid
}
reload_service() {
stop
start
}