Страница 1 из 1

Rtorrent startup

Добавлено: 2009-02-22 9:45:56
Эл
Люди выложите пожалуйста скрипт для rtorrent (без веб морды) на автозапуск после рестарта системы. Заранее спасибо.

Re: Rtorrent startup

Добавлено: 2009-02-22 10:33:30
m0ps
разницы нет, с вебмордой или без.

Код: Выделить всё

%cat /usr/local/etc/rc.d/rtorrent 
#!/bin/sh
#
# rtorrent RCng startup script
# by Emanuele Cipolla (mail at emanuelecipolla dot net)
# Shamelessly ripped off the aMule startup script by Gabriele Cecchetti (amule.org forum)
#

# PROVIDE: rtorrent
# REQUIRE: NETWORKING SERVERS
# BEFORE: DAEMON
# KEYWORD: shutdown

#
# Add the following lines to /etc/rc.conf to enable rtorrent at startup
# rtorrent (bool): Set to "NO" by default.
#                Set it to "YES" to enable rtorrent
# rtorrent_user (str): Set to user running rtorrent
#                    (default 'p2p')
# rtorrent_home (str): Set to home directory of user running rtorrent
#                    (default /home/${rtorrent_user})

. /etc/rc.subr

name="rtorrent"
rcvar=`set_rcvar`

load_rc_config $name

[ -z "$rtorrent_enable" ] && rtorrent_enable="NO"
[ -z "$rtorrent_user" ] && rtorrent_user="p2p"
[ -z "$rtorrent_home" ] && rtorrent_home="/home/${rtorrent_user}"

required_dirs=${rtorrent_home}
required_files="${rtorrent_home}/.rtorrent.rc"

start_cmd="${name}_start"
stop_cmd="${name}_stop"

rtorrent_start()
{
        if [ ! -f /var/run/${name}.run ]
        then
      cd ${rtorrent_home}
       su ${rtorrent_user} -c "/usr/local/bin/screen -dmS rtorrent_init /usr/local/bin/rtorrent"
      touch /var/run/${name}.run
          echo "Started ${name}."
          echo `date` : "Started ${name}." >> /var/log/${name}.log
        else
          echo "${name} seems to be already running -- remove /var/run/${name}.run manually if needed."
        fi
}

rtorrent_stop()
{
        if [ -f /var/run/${name}.run ]
        then
          killall -INT $(echo -n 'ps aux | grep rtorrent | grep -v rtorrent_init') 2>>/var/log/${name}.log >>/var/log/${name}.log
          rm -f /var/run/${name}.run
          echo "Stopped ${name}."
          echo `date` : "Stopped ${name}." >> /var/log/${name}.log
        else
          echo "${name} doesn't seem to be running -- create /var/run/${name}.run if needed."
        fi
}
run_rc_command "$1"

Re: Rtorrent startup

Добавлено: 2009-02-22 10:35:10
m0ps

Код: Выделить всё

/usr/ports/sysutils/screen
обязательно стоять должен