Hi all,
I have a created an init script for rtorrent, to run as a deamon. Problem is the pid files is not created. Don't think it's a permission problem, because running the rtorrent daemon as root instead of "gettons" user it won't be created anyway.
This is the rc script file.
I have a created an init script for rtorrent, to run as a deamon. Problem is the pid files is not created. Don't think it's a permission problem, because running the rtorrent daemon as root instead of "gettons" user it won't be created anyway.
This is the rc script file.
Code:
#!/bin/sh
#
# FreeBSD rtorrent script 2011/03/11
#
# PROVIDE: rtorrent
# REQUIRE: LOGIN NETWORKING
# KEYWORD: shutdown
. /etc/rc.subr
PATH=$PATH:/usr/bin:/usr/local/bin:/usr/local/sbin:/sbin:/bin:/usr/sbin
name="rtorrent"
rcvar=`set_rcvar`
required_files="/home/gettons/.rtorrent.rc"
command="su gettons -c 'screen -d -m -S rtorrent rtorrent'"
start_precmd="rtorrent_precmd"
pidfile="/var/run/rtorrent"
load_rc_config $name
rtorrent_precmd()
{
(
# Can't do anything if rtorrent not installed
[ -x /usr/local/bin/rtorrent ] || {
warn "/usr/loca/bin/rtorrent does not exist."
echo "===================================================="
echo "rtorrent not found"
echo "===================================================="
return 1
}
if [ -f /home/gettons/.rtorrent.rc ]; then
echo "Reading gettons rtorrent conf file" \
"located at /home/gettons/.rtorrent.rc"
else
echo "/home/gettons/.rtorrent.rc not found!"
fi
)
}
load_rc_config $name
run_rc_command "$1"