Hirdetés

Új hozzászólás Aktív témák

  • meone

    tag

    válasz yamshee #5053 üzenetére

    Kiadtam 2 féle képpen is parancsot ime az eredmény:

    [root@001346178395 root]$ /opt/etc/init.d/S99rtorrent
    Usage: /etc/init.d/rtorrent {start|stop|restart|force-reload}
    [root@001346178395 root]$ /opt/etc/init.d/S99rtorrent start
    Starting rtorrent: rtorrent.

    Ezek után kiadtam a ps-ax parancsot ereménye:

    PID TTY STAT TIME COMMAND
    1 ? S 0:01 /sbin/init
    2 ? S 0:00 [keventd]
    3 ? SN 0:00 [ksoftirqd_CPU0]
    4 ? S 0:00 [kswapd]
    5 ? S 0:00 [bdflush]
    6 ? S 0:00 [kupdated]
    7 ? S 0:00 [mtdblockd]
    61 ? S 0:00 telnetd
    62 ? S 0:00 httpd eth1
    68 ? S 0:00 [dnsmasq]
    69 ? S 0:00 syslogd -m 0 -O /tmp/syslog.log -S -l 7
    70 ? S 0:00 klogd
    75 ? S 0:00 [khubd]
    83 ? Ss 0:00 lpd
    85 ? Ss 0:00 p9100d -f /dev/usb/lp0 0
    89 ? Ss 0:00 waveservermain
    91 ? Ss 0:00 rcamdmain
    95 ? S 0:00 [usb-storage-0]
    96 ? S 0:00 [scsi_eh_0]
    108 ? Ss 0:00 infosvr br0
    109 ? Ss 0:00 watchdog
    112 ? Ss 0:00 ntp
    118 ? S 0:00 [kjournald]
    124 ? S 0:00 dropbear
    134 ? Ss 0:00 /usr/sbin/smbd -D -l /opt/var/log/smbd.log -s /opt/et
    136 ? Ss 0:00 /usr/sbin/nmbd -D -n ASUS -o -l /tmp -s /opt/etc/samb
    150 ? S 0:00 [kjournald]
    158 ? S 0:00 /opt/sbin/lighttpd -f /opt/etc/lighttpd/lighttpd.conf
    159 ? Ss 0:00 /opt/bin/php-fcgi
    160 ? Ss 0:00 /opt/bin/php-fcgi
    161 ? Ss 0:00 /opt/bin/php-fcgi
    162 ? Ss 0:00 /opt/bin/php-fcgi
    163 ? S 0:00 /opt/bin/php-fcgi
    164 ? S 0:00 /opt/bin/php-fcgi
    165 ? S 0:00 /opt/bin/php-fcgi
    166 ? S 0:00 /opt/bin/php-fcgi
    234 ? S 0:00 upnp -D -L br0 -W eth1
    236 ? Ss 0:01 dropbear
    237 pts/0 Ss 0:00 -sh
    275 pts/0 R+ 0:00 ps -ax

    Az S99rtorrent konfigfájlja pedig a következő:

    user="root"

    # the system group to run as, not implemented, see d_start for beginning implementation
    # group=`id -ng "$user"`

    #prefix="/opt"
    config="/opt/etc/rtorrent.conf"
    # the full path to the filename where you store your rtorrent configuration
    #if [ ${dirlayout} = RTORRENT_DEFAULT ] ; then
    # config="${prefix}/home/${user}/.rtorrent.rc"
    #else
    ##config="/opt/etc/rtorrent.conf"
    #fi
    options="-n -o import=${config}"
    # set of options to run with
    #if [ ${dirlayout} = RTORRENT_DEFAULT ] ; then
    # options=""
    #else
    ## OPTIONS="-n -o import=${config}"
    #fi

    # default directory for screen, needs to be an absolute path
    #if [ ${dirlayout} = RTORRENT_DEFAULT ] ; then
    # base="${prefix}/home/${user}"
    #else
    ## BASE="/opt/etc/samba/Share/torrent"
    #fi
    base="/opt/etc/samba/Share/torrent"
    # name of screen session
    ##SRNAME=rtorrent
    srnname="rtorrent"
    # file to log to (makes for easier debugging if something goes wrong)
    ##logfile="/opt/var/log/rtorrentInit.log"
    logfile="/opt/etc/samba/Share/download/torrentInit.log"

    PATH=/opt/bin:/opt/sbin:/usr/bin:/sbin:/bin:/usr/sbin
    DESC="rtorrent"
    NAME=rtorrent
    DAEMON=$NAME
    SCRIPTNAME=/etc/init.d/$NAME

    # Do not proceed unless some apps are available.
    test -x /opt/bin/screen || ( echo "screen not found." | tee -a "$logfile" >&2 ; exit 2 )
    test -x /opt/bin/su -o -x /bin/su || ( echo "su not found." | tee -a "$logfile" >&2 ; exit 2 )
    ##test -x /opt/bin/screen || ( echo "screen not found." | tee -a "$logfile" >&2 ; exit 2 )

    checkcnfg() {
    exists=0
    for i in `echo "$PATH" | tr ':' '\n'` ; do
    if [ -f $i/$NAME ] ; then
    exists=1
    break
    fi
    done
    if [ $exists -eq 0 ] ; then
    echo "cannot find rtorrent binary in PATH $PATH" | tee -a "$logfile" >&2
    ##echo "cannot find rtorrent binary in PATH $PATH" | tee -a "$logfile" >&2
    exit 3
    fi

    if ! [ -r "${config}" ] ; then
    echo "cannot find readable config ${config}. check that it is there and permissio
    ##echo "cannot find readable config ${config}. check that it is there and permissions are appropr

    exit 3
    fi
    }

    d_start() {
    [ -d "${base}" ] && cd "${base}"
    stty stop undef && stty start undef
    su -c "screen -ls | grep -sq "\.${srname}[[:space:]]" " ${user} || su -c "screen -dm -S ${srnam
    ## this works for the screen command, but starting rtorrent below adopts screen session gid
    ## even if it is not the screen session we started (e.g. running under an undesirable gid
    # su -c "screen -ls | grep -sq "\.${srnname}[[:space:]]" " ${user} || su -c "sg \"$group\" -c \"
    su -c "screen -S "${srnname}" -X screen rtorrent ${options} 2>&1 1>/dev/null" ${user} | tee -a "
    }

    d_stop() {
    session=`getsession "$config"`
    if ! [ -s ${session}/rtorrent.lock ] ; then
    return
    fi
    pid=`cat ${session}/rtorrent.lock | awk -F: '{print($2)}' | sed "s/[^0-9]//g"`
    if ps-A | grep -sq ${pid}.*rtorrent ; then # if ps -A | grep -sq ${pid}.*rtorrent ; th
    kill -s INT ${pid}
    fi
    }

    getsession() {
    session=`awk '/^[[:space:]]*session[[:space:]]*=[[:space:]]*/{print($3)}' "$config"`
    echo $session
    }


    ##getprange() {
    ##ports=`awk '/^[[:space:]]*port_range[[:space:]]*=[[:space:]]*/{print($3)}' "$config" | sed "s/-
    #echo $ports
    #}
    ##
    #getdhtport() {
    ##dht_port=`awk '/^[[:space:]]*dht_port[[:space:]]*=[[:space:]]*/{print($3)}' "$config"`
    ##echo $dht_port
    ##}

    ## fwopen() {
    # DHT_PORT=`getdhtport "$config"`
    # iptables -D INPUT -j DROP
    # PORTS=$(seq `getprange "$config"`)
    # for P in $PORTS; do
    # iptables -I INPUT -i vlan1 -p tcp --syn --dport $P -j ACCEPT
    # done
    # if [ $DHT_PORT ]; then
    # iptables -I INPUT -i vlan1 -p tcp --dport $DHT_PORT -j ACCEPT
    # fi
    # iptables -A INPUT -j DROP
    # }

    # fwclose() {
    # DHT_PORT=`getdhtport "$config"`
    # PORTS=$(seq `getprange "$config"`)
    # for P in $PORTS; do
    # iptables -D INPUT -i vlan1 -p tcp --syn --dport $P -j ACCEPT
    # done
    # if [ $DHT_PORT ]; then
    # iptables -D INPUT -i vlan1 -p tcp --dport $DHT_PORT -j ACCEPT
    # fi
    # }

    #d_start() {
    #[ -d "${BASE}" ] && cd "${BASE}"
    #fwopen
    #stty stop undef && stty start undef
    #screen -ls | grep .$SRNAME[[:space:]] > /dev/null || \screen -dm -S ${SRNAME}
    #screen -S ${SRNAME} -X screen rtorrent ${OPTIONS} 2>&1 1>/dev/null | tee -a "$logfile"
    #}

    #d_stop() {
    #fwclose
    #session=`getsession "$config"`
    #if ! [ -s ${session}/rtorrent.lock ] ; then
    #return
    #fi
    #pid=`cat ${session}/rtorrent.lock | awk -F: '{print($2)}' | sed "s/[^0-9]//g"`
    #if ps -A | grep -sq ${pid}.*rtorrent ; then # make sure the pid doesn't belong to another proces
    #kill -s INT ${pid}
    #fi
    #}

    checkcnfg

    case "$1" in
    start)
    echo -n "Starting $DESC: $NAME"
    d_start
    echo "."
    ;;
    stop)
    echo -n "Stopping $DESC: $NAME"
    d_stop
    echo "."
    ;;
    restart|force-reload)
    echo -n "Restarting $DESC: $NAME"
    d_stop
    sleep 1
    d_start
    echo "."
    ;;
    *)
    echo "Usage: $SCRIPTNAME {start|stop|restart|force-reload}" >&2
    #echo "Usage: $0 {start|stop|restart|force-reload}" >&2
    exit 1
    ;;
    esac

    exit 0

    Valakinek valami ötlete mi a hibám?
    Mit kellen esetleg beletenni még vagy mit vegyek ki? :F

    Elnézést kérek mindenkitől a helyes írásom ért :)

Új hozzászólás Aktív témák