Code: Select all
#!/bin/bash
me="$(basename "$(test -L "$0" && readlink "$0" || echo "$0")")"
if [ $# -ge 4 ]
then
user="$1"
password="$2"
daemon_port="$3"
web_port="$4"
dir="/home/$user/.config/deluge"
if [ ! -d "$dir" ]; then
check_port_using=$(ps aux | egrep "[-]-port $daemon_port")
if [ -z "$check_port_using" ]; then
true &>/dev/null </dev/tcp/127.0.0.1/$daemon_port && check_port='0' || check_port='1'
if [ "$check_port" -eq "1" ]; then
true &>/dev/null </dev/tcp/127.0.0.1/$web_port && check_port_web='0' || check_port_web='1'
if [ "$check_port_web" -eq "1" ]; then
if getent passwd $1 > /dev/null 2>&1; then
echo ""
else
adduser "$user"
echo "$password" | passwd "$user" --stdin
fi
sudo su $user -c "deluged --config $dir --port $daemon_port"
sudo su $user -c "deluge-web --config $dir --port $web_port --fork"
sleep 1
pid=$(ps aux | grep -i $dir | awk {'print $2'})
A="$(cut -d' ' -f1 <<< $pid)"
B="$(cut -d' ' -f2 <<< $pid)"
kill $A
kill $B
sed -i "s/port.*/port\": $web_port/" $dir/web.conf
sed -i "s/allow_remote.*/allow_remote\": true,/" $dir/core.conf
sed -i "s/daemon_port.*/daemon_port\": $daemon_port,/" $dir/core.conf
sudo su $user -c "echo '$user:$password:10' >> $dir/auth"
sudo su $user -c "deluge-web --config $dir --port $web_port --fork"
sudo su $user -c "deluged --config $dir --port $daemon_port"
else
echo "The port $web_port is taken"
fi
else
echo "The port $daemon_port is taken"
fi
else
echo "A Deluge instance is already running on port $daemon_port"
fi
else
echo "The user $user already have an account"
fi
else
echo "$me <username> <password> <daemon port> <web port>"
fi
But on the webui the daemon seems offline.
And on deluge-console, I can't connect to any daemon.
Content of deluge config of user test
auth
Code: Select all
localclient:650ad6d782c6a17a24197fc353eefbe4a745df24:10
test:root:5
Code: Select all
{
"file": 1,
"format": 1
}{
"info_sent": 0.0,
"lsd": true,
"max_download_speed": -1.0,
"send_info": false,
"natpmp": true,
"move_completed_path": "/home/test/Downloads",
"peer_tos": "0x00",
"enc_in_policy": 1,
"queue_new_to_top": false,
"ignore_limits_on_local_network": true,
"rate_limit_ip_overhead": true,
"daemon_port": 58840,
"torrentfiles_location": "/home/test/Downloads",
"max_active_limit": 8,
"geoip_db_location": "/usr/share/GeoIP/GeoIP.dat",
"upnp": true,
"utpex": true,
"max_active_downloading": 3,
"max_active_seeding": 5,
"allow_remote": true,
"outgoing_ports": [
0,
0
],
"enabled_plugins": [],
"max_half_open_connections": 50,
"download_location": "/home/test/Downloads",
"compact_allocation": false,
"max_upload_speed": -1.0,
"plugins_location": "/home/test/.config/deluge/plugins",
"max_connections_global": 200,
"enc_prefer_rc4": true,
"cache_expiry": 60,
"dht": true,
"stop_seed_at_ratio": false,
"stop_seed_ratio": 2.0,
"max_download_speed_per_torrent": -1,
"prioritize_first_last_pieces": false,
"max_upload_speed_per_torrent": -1,
"auto_managed": true,
"enc_level": 2,
"copy_torrent_file": false,
"max_connections_per_second": 20,
"listen_ports": [
6881,
6891
],
"max_connections_per_torrent": -1,
"del_copy_torrent_file": false,
"move_completed": false,
"autoadd_enable": false,
"proxies": {
"peer": {
"username": "",
"password": "",
"hostname": "",
"type": 0,
"port": 8080
},
"web_seed": {
"username": "",
"password": "",
"hostname": "",
"type": 0,
"port": 8080
},
"tracker": {
"username": "",
"password": "",
"hostname": "",
"type": 0,
"port": 8080
},
"dht": {
"username": "",
"password": "",
"hostname": "",
"type": 0,
"port": 8080
}
},
"dont_count_slow_torrents": false,
"add_paused": false,
"random_outgoing_ports": true,
"max_upload_slots_per_torrent": -1,
"new_release_check": true,
"enc_out_policy": 1,
"seed_time_ratio_limit": 7.0,
"remove_seed_at_ratio": false,
"autoadd_location": "/home/test/Downloads",
"max_upload_slots_global": 4,
"seed_time_limit": 180,
"cache_size": 512,
"share_ratio_limit": 2.0,
"random_port": true,
"listen_interface": ""
}
Code: Select all
{
"file": 1,
"format": 1
}{
"port": 8140,
"enabled_plugins": [],
"pwd_sha1": "2ce1a410bcdcc53064129b6d950f2e9fee4edc1e",
"theme": "gray",
"show_sidebar": true,
"sidebar_show_zero": false,
"pkey": "ssl/daemon.pkey",
"https": false,
"sessions": {
"111859060b3446c9f525d54760265b2d": {
"login": "admin",
"expires": 1541696000.0,
"level": 10
}
},
"base": "/",
"pwd_salt": "c26ab3bbd8b137f99cd83c2c1c0963bcc1a35cad",
"show_session_speed": false,
"first_login": false,
"cert": "ssl/daemon.cert",
"session_timeout": 3600,
"default_daemon": "",
"sidebar_multiple_filters": true
}