mirror of
https://github.com/caiwx86/small-packages.git
synced 2026-09-14 04:14:40 +08:00
update 2026-05-13 01:55:45
This commit is contained in:
@@ -0,0 +1,43 @@
|
||||
#!/bin/sh /etc/rc.common
|
||||
START=50
|
||||
|
||||
run_syncthing()
|
||||
{
|
||||
local enabled
|
||||
config_get_bool enabled $1 enabled
|
||||
if [ $enabled = 1 ]; then
|
||||
local port
|
||||
config_get port $1 port
|
||||
state=`pgrep syncthing | wc -l`
|
||||
if [ $state = 0 ] ; then
|
||||
export HOME="/root"
|
||||
syncthing -gui-address="0.0.0.0:$port" -logfile="/var/log/syncthing.log" -no-browser >/dev/null &
|
||||
echo "启动中..."
|
||||
start=`pgrep syncthing | wc -l`
|
||||
if [ $start = 0 ] ; then
|
||||
echo "启动失败"
|
||||
else
|
||||
echo "启动成功"
|
||||
fi
|
||||
else
|
||||
echo "已在运行"
|
||||
fi
|
||||
fi
|
||||
}
|
||||
|
||||
start()
|
||||
{
|
||||
config_load "luci-app-syncthing"
|
||||
config_foreach run_syncthing setting
|
||||
}
|
||||
|
||||
stop()
|
||||
{
|
||||
kill -9 `pgrep syncthing`
|
||||
stop=`pgrep syncthing | wc -l`
|
||||
if [ $stop = 0 ] ; then
|
||||
echo "已停止运行"
|
||||
else
|
||||
echo "未停止运行"
|
||||
fi
|
||||
}
|
||||
Reference in New Issue
Block a user