packages/net/sysuh3c/files/sysuh3c.init
2024-10-19 18:29:48 +08:00

44 lines
775 B
Bash
Executable File

#!/bin/sh /etc/rc.common
START=70
run_h3c()
{
local enable
config_get_bool enable $1 enable
if [ "$enable" == 1 ]; then
local username
local password
local method
local ifname
local blockstartup
config_get username $1 username
config_get password $1 password
config_get method $1 method
config_get ifname $1 ifname
config_get_bool blockstartup $1 blockstartup
if [ "$blockstartup" == 1 ]; then
while ! sysuh3c -u $username -p $password -i $ifname -m $method ; do
echo sysuh3c: process exited unexpectedly, restarting..
sleep 1
done
else
sleep 5
sysuh3c -u $username -p $password -i $ifname -m $method &
fi
fi
}
start()
{
config_load sysuh3c
config_foreach run_h3c login
}
stop()
{
killall sysuh3c >/dev/null 2>&1
}