Page 3 of 3

Re: Multiple user/daemon on CentOS 7

Posted: Fri Oct 26, 2018 7:00 am
by executable77
DjLegolas wrote:Go to Preferences =>Interface.
But on the first Login (without using the web interface) ? And also how can I configure the default daemon without using the web interface ?

I also have a test script who launch a deluge-web instance and stop it. I need this because it will create the default files.

Here what I have trie but doesn't work :

Code: Select all

#!/bin/bash

deluge-web --config /home/deluge_user/ --port 8171 #Launch deluge-web
pid=$(ps aux | grep "deluge-web.*user\|user.*deluge-web") #find the processus
var1=$(echo $pid | cut -f2 -d ' ') # isolate the pid
kill $var1 # kill the processus
I also tryed with --fork but stopping it doesn't create the default files

Re: Multiple user/daemon on CentOS 7

Posted: Fri Oct 26, 2018 2:38 pm
by Cas
But on the first Login (without using the web interface) ?
Not really, there could be a way using scripting.
And also how can I configure the default daemon without using the web interface ?
You will have to explain what you mean. If you are using the same config directory as the daemon then it will use that one.
I also have a test script who launch a deluge-web instance and stop it.

Code: Select all

#!/bin/bash
timeout 1 deluge-web --config test_conf --port 8171

Code: Select all

#!/bin/bash
deluge-web --config test_conf --port 8171 &
var1=$1
sleep 1
kill "$var1"

Re: Multiple user/daemon on CentOS 7

Posted: Tue Oct 30, 2018 10:09 am
by executable77
The command is creating the web.conf file but the core.conf isn't generated

EDIT:

The script :

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/deluge_$user"
    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 /home/$user/deluge_$user --port $daemon_port"
                    sudo su $user -c "timeout 1 deluge-web --config  /home/$user/deluge_$user --port $daemon_port"
                    (echo >/dev/tcp/localhost/$web_port) &>/dev/null && port_stat="open" || port_stat="closed"
                    if [ "$port_stat" = "closed" ]; then
                        firewall-cmd --zone=public --add-port=$web_port/tcp --permanent
                        firewall-cmd --reload
                    fi
                    sudo su $user -c "echo '$user:$password:5' >> /home/$user/deluge_$user/auth"
                    sudo su $user -c "deluge-web --config /home/$user/deluge_$user --port $web_port --fork"
                    #sed -i 's/port.*/port": $web_port/' /root/$user/web.conf
                else
                     echo "Port $web_port is taken"
                fi
            else
                echo "Port $daemon_port is taken"
            fi
        else
            echo "A Deluge instance is running on port $daemon_port"
        fi
    else
        echo "The user $user already have an account on Deluge"
    fi
else
    echo "$me <username> <password> <daemon port> <web port>"
fi
The script is creating the new user and new daemon, I can access it (except the core.conf isn't generated) butI have this error. What could it be ?

Image