Create a gist now

Instantly share code, notes, and snippets.

@Grogdor /rtorrent
Last active Sep 13, 2017

What would you like to do?
rtorrent FreeBSD startup rc.d service script tmux user
# $FreeBSD$
# Runs as unprivileged user "rtorrent"
# Lives in "tmux" (like "screen") because rtorrent can't daemonize itself
# To access rtorrent client that's in the tmux: su - rtorrent && tmux attach
# To detach the tmux and leave rtorrent running: Ctrl-B then D
# nice'd default +10 step to make it go easy on the machine
# Don't forget to put rtorrent_enable="YES" in your /etc/rc.conf
# PROVIDE: rtorrent
# KEYWORD: shutdown
. /etc/rc.subr
load_rc_config $name
: ${rtorrent_enable:=no}
rtorrent_start() {
su - rtorrent -c "tmux new-session -d -s rtorrent 'nice /usr/local/bin/rtorrent'"
rtorrent_stop() {
su - rtorrent -c "tmux send-keys -t rtorrent C-q"
run_rc_command "$1"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment