Right now I've got my Pi in another room hooked up just to router via Ethernet and I'm configuring it over VNC on my windows 7 machine. Mainly due to lack of inputs and displays, but I'd like that to be my eventual setup.
Anyway I've got rtorrent set up, but I would like for it to run at startup without logging in or having to connect to the vnc. How can I do this? Is there a way to do this and still view the program when I do log in to the vnc?
Thanks
- RaTTuS
- Posts: 10703
- Joined: Tue Nov 29, 2011 11:12 am
- Location: North West UK
- Contact: Twitter YouTube
Re: Run rtorrent on startup
well it depends....
how many cats have you ....
seriously
...
never having used it
you are using the console version?
a couple of things you can do
1)
edit /etc/inittab
change
1:2345:respawn:/sbin/getty --noclear 38400 tty1
to be
1:2345:respawn:/bin/login -f pi tty1 </dev/tty1 >/dev/tty1 2>&1
^ change pi to be whatever usename you are using
this means that the 1st console session will automatically log you in as user pi
2)
edit
~/.bash_rc
~/ means your home directory
add right at the end
if [ $(tty) == /dev/tty1 ]; then
rtorrent
fi
this means that if bash sees that you are on console one it will launch rtorrent [change that to be what ever command you want/need].
now you can log in fine on other consoles [f2-f6] with no issues and if you stop the program on console 1 then you can carry on as normal - if you
exit
then it will re-run the program mentioned in the .bashrc file.
...
others will have different methods
how many cats have you ....
seriously
...
never having used it
you are using the console version?
a couple of things you can do
1)
edit /etc/inittab
change
1:2345:respawn:/sbin/getty --noclear 38400 tty1
to be
1:2345:respawn:/bin/login -f pi tty1 </dev/tty1 >/dev/tty1 2>&1
^ change pi to be whatever usename you are using
this means that the 1st console session will automatically log you in as user pi
2)
edit
~/.bash_rc
~/ means your home directory
add right at the end
if [ $(tty) == /dev/tty1 ]; then
rtorrent
fi
this means that if bash sees that you are on console one it will launch rtorrent [change that to be what ever command you want/need].
now you can log in fine on other consoles [f2-f6] with no issues and if you stop the program on console 1 then you can carry on as normal - if you
exit
then it will re-run the program mentioned in the .bashrc file.
...
others will have different methods
How To ask Questions :- http://www.catb.org/esr/faqs/smart-questions.html
WARNING - some parts of this post may be erroneous YMMV
1QC43qbL5FySu2Pi51vGqKqxy3UiJgukSX
Covfefe
WARNING - some parts of this post may be erroneous YMMV
1QC43qbL5FySu2Pi51vGqKqxy3UiJgukSX
Covfefe
Re: Run rtorrent on startup
Ok I did both of those things. I set it for to log into root, then I logged into root on my VNC thing. But when I looked at the task manager there's no rtorrent as there would be if I ran it normally in the terminal.
Re: Run rtorrent on startup
I'm still having trouble with this. Does anyone have any suggestions?
- RaTTuS
- Posts: 10703
- Joined: Tue Nov 29, 2011 11:12 am
- Location: North West UK
- Contact: Twitter YouTube
Re: Run rtorrent on startup
ssh into it and
sudo apt-get install pastebinit
w
and
ps axOT | pastebinit
who is logged in
sudo apt-get install pastebinit
w
and
ps axOT | pastebinit
who is logged in
How To ask Questions :- http://www.catb.org/esr/faqs/smart-questions.html
WARNING - some parts of this post may be erroneous YMMV
1QC43qbL5FySu2Pi51vGqKqxy3UiJgukSX
Covfefe
WARNING - some parts of this post may be erroneous YMMV
1QC43qbL5FySu2Pi51vGqKqxy3UiJgukSX
Covfefe
Re: Run rtorrent on startup
I am logged in as root, and that is the only user.
http://paste.debian.net/180559
http://paste.debian.net/180559
- RaTTuS
- Posts: 10703
- Joined: Tue Nov 29, 2011 11:12 am
- Location: North West UK
- Contact: Twitter YouTube
Re: Run rtorrent on startup
that pastebin is of no use for this problem
no need to log in as root, a normal user is fine
cat /etc/rc.local
cat /etc/inittab
tail ~/bashrc
no need to log in as root, a normal user is fine
cat /etc/rc.local
cat /etc/inittab
tail ~/bashrc
How To ask Questions :- http://www.catb.org/esr/faqs/smart-questions.html
WARNING - some parts of this post may be erroneous YMMV
1QC43qbL5FySu2Pi51vGqKqxy3UiJgukSX
Covfefe
WARNING - some parts of this post may be erroneous YMMV
1QC43qbL5FySu2Pi51vGqKqxy3UiJgukSX
Covfefe
Re: Run rtorrent on startup
The correct way to do this is with a service:
You could use screen or run as an underprivileged or chrooted user, etc.
(indentation is killed by phpBB
)
then#!/bin/bash
#
#/etc/init.d/rtorrent
#
NAME=rtorrent
PID=$(pidof $NAME);
function start {
if [ "$PID" = "" ] ; then
echo "Starting $NAME...";
tmux new-session -d -n $NAME -s $NAME rtorrent
echo " Done.";
else
echo "$NAME is already running as $PID.";
fi
}
function stop {
if [ "$PID" != "" ] ; then
echo "Stoping $NAME...";
kill $PID;
TIMEOUT=30;
START=$( date +%s);
while [ $(( $( date +%s) - ${START} )) -lt ${TIMEOUT} ]; do
PID=$(tmux ls |grep rtorrent);
if [ "$PID" == "" ]; then break
else sleep 2
fi
done
if [ "$PID" != "" ] ; then
echo "Error: $NAME would not stop";
else
echo " Done.";
fi
else
echo "$NAME is was not running.";
fi
}
function status {
if [ "$PID" = "" ]; then
echo "$NAME is not running";
else
echo "$NAME is running with pid $PID";
fi
}
if [ "$1" = "start" ]; then
start
elif [ "$1" = "stop" ]; then
stop
elif [ "$1" = "restart" ]; then
stop
start
elif [ "$1" = "status" ]; then
status
else
echo " * Usage: /etc/init.d/$NAME [start|status|stop|restart]";
fi
Code: Select all
update-rc.d rtorrent defaults
service rtorrent start
(indentation is killed by phpBB

SBC with 32GB RAM: https://hardkernel.com
FAQ : https://raspberrypi.stackexchange.com
Unanswered: https://www.raspberrypi.org/forums/search.php?search_id=unanswered
FAQ : https://raspberrypi.stackexchange.com
Unanswered: https://www.raspberrypi.org/forums/search.php?search_id=unanswered