mirror of
https://github.com/novatiq/packages.git
synced 2026-04-30 15:38:40 +01:00
aria2: add log
add aria2.log and replace logger -t ARIA2C 'Restarting aria2s service' with logger -t ARIA2C 'Restarting aria2c service' :D :p Signed-off-by: Hsing-Wang Liao <kuoruan@gmail.com>
This commit is contained in:
@@ -42,16 +42,24 @@ start_instance() {
|
|||||||
config_file="$config_dir/aria2.conf"
|
config_file="$config_dir/aria2.conf"
|
||||||
session_file="$config_dir/aria2.session"
|
session_file="$config_dir/aria2.session"
|
||||||
dht_file="$config_dir/dht.dat"
|
dht_file="$config_dir/dht.dat"
|
||||||
|
log_file="$config_dir/aria2.log"
|
||||||
|
|
||||||
[ -d "$config_dir" ] || {
|
[ -d "$config_dir" ] || {
|
||||||
mkdir -m 0755 -p "$config_dir"
|
mkdir -m 0755 -p "$config_dir"
|
||||||
touch "$config_file"
|
touch "$config_file"
|
||||||
[ -z "$user" ] || chown -R $user $config_dir
|
[ -z "$user" ] || chown -R $user $config_dir
|
||||||
}
|
}
|
||||||
|
|
||||||
touch "$session_file"
|
touch "$session_file"
|
||||||
|
|
||||||
echo -e "enable-rpc=true\nrpc-allow-origin-all=true\nrpc-listen-all=true\nquiet=true" > $config_file
|
echo -e "enable-rpc=true\nrpc-allow-origin-all=true\nrpc-listen-all=true\nquiet=true" > $config_file
|
||||||
echo -e "continue=true\ninput-file=$session_file\nsave-session=$session_file" >> $config_file
|
echo -e "continue=true\ninput-file=$session_file\nsave-session=$session_file" >> $config_file
|
||||||
|
|
||||||
option_disabled "$s" 'enable_dht' || echo "dht-file-path=$dht_file" >> $config_file
|
option_disabled "$s" 'enable_dht' || echo "dht-file-path=$dht_file" >> $config_file
|
||||||
|
option_disabled "$s" 'enable_log' || {
|
||||||
|
touch "$log_file"
|
||||||
|
echo -e "log=$log_file" >> $config_file
|
||||||
|
}
|
||||||
|
|
||||||
append_params "$s" \
|
append_params "$s" \
|
||||||
file_allocation bt_enable_lpd enable_dht rpc_user rpc_passwd rpc_listen_port dir bt_tracker disk_cache \
|
file_allocation bt_enable_lpd enable_dht rpc_user rpc_passwd rpc_listen_port dir bt_tracker disk_cache \
|
||||||
@@ -85,7 +93,7 @@ stop() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
restart() {
|
restart() {
|
||||||
logger -t ARIA2C 'Restarting aria2s service'
|
logger -t ARIA2C 'Restarting aria2c service'
|
||||||
stop
|
stop
|
||||||
sleep 2 # give time to shutdown
|
sleep 2 # give time to shutdown
|
||||||
start
|
start
|
||||||
|
|||||||
Reference in New Issue
Block a user