37 lines
834 B
Bash
37 lines
834 B
Bash
#!/bin/sh /etc/rc.common
|
|
|
|
START=99
|
|
USE_PROCD=1
|
|
PROG=/usr/bin/qbittorrent-nox
|
|
|
|
get_config() {
|
|
config_get_bool enabled $1 enabled 1
|
|
config_get port $1 port 8080
|
|
config_get profile_dir $1 profile_dir "/etc/qbittorrent"
|
|
}
|
|
|
|
start_service() {
|
|
config_load qbittorrent
|
|
config_foreach get_config qbittorrent
|
|
[ $enabled != 1 ] && return 1
|
|
if [ ! -f "$profile_dir/qBittorrent/config/qBittorrent.conf" ]; then
|
|
mkdir -p $profile_dir/qBittorrent/config/
|
|
cp /usr/share/qbittorrent/qBittorrent.conf.example $profile_dir/qBittorrent/config/qBittorrent.conf
|
|
fi
|
|
procd_open_instance
|
|
procd_set_param command $PROG
|
|
procd_append_param command --webui-port=$port --profile=$profile_dir
|
|
procd_set_param respawn
|
|
procd_close_instance
|
|
}
|
|
|
|
service_triggers() {
|
|
procd_add_reload_trigger "qbittorrent"
|
|
}
|
|
|
|
reload_service() {
|
|
stop
|
|
sleep 1
|
|
start
|
|
}
|