You are not logged in.

#1 2010-08-31 16:46:50

jdl55
Member
Registered: 2010-08-31
Posts: 10

rc.local

Hello, i've been having problems getting rc.local to work correctly.  here is a copy of my file:

#start bandwidthd, irssi, and rtorrent
/usr/bin/screen -d -m /usr/bin/rtorrent
/usr/bin/irssi
/usr/local/bandwidthd/bandwidthd


my objective is to start rtorrent in the background, start the bandwidthd process, and start irssi in the foreground.  i've tried many permutations of this, is there anything obvious i'm missing?  in its current state only bandwidthd successfully starts.

Offline

#2 2010-08-31 17:16:54

karol
Archivist
Registered: 2009-05-06
Posts: 25,440

Re: rc.local

'/usr/local/bandwidthd/bandwidthd &' should start bandwidthd in the background.

Last edited by karol (2010-08-31 17:19:43)

Offline

#3 2010-08-31 17:22:33

jdl55
Member
Registered: 2010-08-31
Posts: 10

Re: rc.local

karol wrote:

'/usr/local/bandwidthd/bandwidthd &' should start bandwidthd in the background.

if i understand it correctly running the bandwidthd process already happens in the background, bandwidthd just needs to be told to start monitoring data, the output is all done through the web interface.  bandwidthd also is already starting successfully, its irssi and rtorrent that never seem to start

Offline

#4 2010-08-31 17:23:57

karol
Archivist
Registered: 2009-05-06
Posts: 25,440

Re: rc.local

Adding '&' at the end of the line starts the app in the background.

Offline

#5 2010-08-31 21:42:43

jdl55
Member
Registered: 2010-08-31
Posts: 10

Re: rc.local

with respect, i don't really think you're understanding my question / problem.  the issue is not trying to start bandwidthd, or any of these programs in the background, its that they're not starting at all.  the bandwidthd process is a daemon, and already runs in the background, thus making the & unnecessary.  the only process i want in the background is rtorrent, and i'm using screen to do that (i've tried using & for this too but neither seem to work).  but none of that really even matters!

rtorrent and irssi do not start.  foreground or background.  bandwidthd is the one program that does seem to start for whatever reason.  i have no problems managing which processes have the foreground and which have the background, but none of that matters if these programs refuse to start on boot.

is there any reason that anybody sees that might cause these programs not to start?

Offline

#6 2010-08-31 21:52:38

karol
Archivist
Registered: 2009-05-06
Posts: 25,440

Re: rc.local

I think irssi needs a terminal to run: 'xterm -e irssi'.

Offline

#7 2010-08-31 21:55:07

schen
Member
Registered: 2009-06-06
Posts: 468

Re: rc.local

So does rtorrent.

Offline

#8 2010-08-31 21:56:41

karol
Archivist
Registered: 2009-05-06
Posts: 25,440

Re: rc.local

schen wrote:

So does rtorrent.

Can screen be used to manage them both?

Offline

#9 2010-08-31 22:03:15

olvar
Member
Registered: 2009-11-13
Posts: 97

Re: rc.local

IIRC rc.local is run as root, so you should either use sudo to run your applications, or find a better place for them.
It wouldn't surprise me that your problem is that those apps are refusing to start as root.

Last edited by olvar (2010-08-31 22:05:20)

Offline

#10 2010-08-31 22:06:44

some-guy94
Member
Registered: 2009-08-15
Posts: 360

Re: rc.local

You could try using su -c your_username "command"

Offline

#11 2010-08-31 22:07:08

karol
Archivist
Registered: 2009-05-06
Posts: 25,440

Re: rc.local

olvar wrote:

IIRC rc.local is run as root, so you should either use sudo to run your applications, or find a better place for them.

Indeed, some people would prefer to put those in .bashrc, .xinitrc etc. but I think root can run all apps. Still, irssi needs terminal to run, root or not.

I've just run irssi as root, no problems whatsoever.

Last edited by karol (2010-08-31 22:09:12)

Offline

#12 2010-08-31 23:14:01

Banton
Member
Registered: 2010-05-28
Posts: 67

Re: rc.local

I think you should start screen with sudo screen -m -d to run it as user not as root. Don't believe running rtorrent or irssi is such a good idea. and then go to your .screenrc file and add there lines like this for every application that should run in screen

 screen -t TITLE EXECUTABLE 

Offline

#13 2010-08-31 23:38:10

jdl55
Member
Registered: 2010-08-31
Posts: 10

Re: rc.local

this is for a server that essentially only runs those 3 programs, as well as ssh and samba.  i run everything as root, although that may cause me to get yelled at by people who know better.  i have no window manager, no desktop environment, everything is done in shell. 

i tried to install xterm and apply the suggestions that were made but i'm getting this error:
xterm Xt error: Can't open display: %s
xterm:  DISPLAY is not set
does xterm depend on x as the name would lead me to believe?  i don't have an x server set up, nor do i plan to.

Offline

#14 2010-08-31 23:44:20

karol
Archivist
Registered: 2009-05-06
Posts: 25,440

Re: rc.local

I have no problems starting irssi in the console. Yes, xterm needs some kind of X.

/etc/rc.local: Local multi-user startup script.

I think olvar was saying, that the file doesn't get executed at all, because you log in as root.

Edit: Umm, no, rc.local executes *before* I log in.

Last edited by karol (2010-08-31 23:53:15)

Offline

#15 2010-08-31 23:51:06

Procyon
Member
Registered: 2008-05-07
Posts: 1,819

Re: rc.local

karol wrote:

Yes, xterm needs some kind of X.

Did you read his post? Don't suggest he needs to install X. Drop the xterm idea. Set up your applications to launch on starting up screen using a ~/.screenrc, test it out, and make the appropriate user launch "screen -d -m" in rc.local.

Offline

#16 2010-08-31 23:54:59

karol
Archivist
Registered: 2009-05-06
Posts: 25,440

Re: rc.local

jdl55 wrote:

does xterm depend on x as the name would lead me to believe?

karol wrote:

I have no problems starting irssi in the console. Yes, xterm needs some kind of X.

Procyon wrote:

Did you read his post? Don't suggest he needs to install X. Drop the xterm idea.

Procyon, what's wrong with you?

Last edited by karol (2010-08-31 23:56:42)

Offline

#17 2010-09-01 03:01:17

jdl55
Member
Registered: 2010-08-31
Posts: 10

Re: rc.local

Procyon wrote:
karol wrote:

Yes, xterm needs some kind of X.

Did you read his post? Don't suggest he needs to install X. Drop the xterm idea. Set up your applications to launch on starting up screen using a ~/.screenrc, test it out, and make the appropriate user launch "screen -d -m" in rc.local.


i'll try this thanks, no time now though, will post results later

Offline

Board footer

Powered by FluxBB