You are not logged in.

#1 2008-11-18 07:22:36

zeddD1abl0
Member
Registered: 2008-07-10
Posts: 25

No GUI -> Start at login

Hi all.

I'm setting up a "skinny" server that is basically the Arch default install with rtorrent, samba, ssh, nzbget and mdadm. There is no GUI installed (not even X, it isn't needed). The only problem I have now is, I can't figure out how to get my programs running on install. Samba and SSH both have their demons and mdadm isn't quite ready for my use yet (haven't configured it). I need a way of starting nzbget and rtorrent to start on login. I created a separate user just for the express purpose of running these programs. I'm using mingetty for the autologin, so that part is taken care of.

If someone could assist, that would be awesome. Normally I do pretty well with my googlefu and some wiki browsing, but I can;t find anything on this topic. Help would be awesome.

Also, does anyone know of an RSS aggregator that can pass the subscriptions to another program? So when I swap to Windows (for high-end gaming purposes) I can still get my RSS feeds.

Thankyou

ZeddD1abl0

Offline

#2 2008-11-18 14:20:45

string
Member
Registered: 2008-11-03
Posts: 286

Re: No GUI -> Start at login

How about something along the lines of (in /etc/rc.local):

#!/bin/bash

su - APPROPRIATEUSERNAME -c "screen -d -m rtorrent"
<...>

.. or somesuch. You'll find GNU Screen in "extra" -- also, `man screen` would be a good idea at this point.

Last edited by string (2008-11-18 14:22:55)

Offline

#3 2008-11-18 21:45:58

fukawi2
Ex-Administratorino
From: .vic.au
Registered: 2007-09-28
Posts: 6,224
Website

Re: No GUI -> Start at login

Would an rc script be suitable so it could just be included in the DAEMONS array in rc.conf?

You can copy a template from /usr/share/pacman/rc-script.proto

Offline

#4 2008-11-18 22:12:06

moljac024
Member
From: Serbia
Registered: 2008-01-29
Posts: 2,676

Re: No GUI -> Start at login

What about ~/.bash_profile ?

EDIT: That wouldn't work if you log into more TTY's.
You could use some simple bash scripts to see if the apps you want are running and if not, start them, otherwise do nothing.

Last edited by moljac024 (2008-11-18 22:13:26)


The day Microsoft makes a product that doesn't suck, is the day they make a vacuum cleaner.
--------------------------------------------------------------------------------------------------------------
But if they tell you that I've lost my mind, maybe it's not gone just a little hard to find...

Offline

#5 2008-11-19 01:41:52

zeddD1abl0
Member
Registered: 2008-07-10
Posts: 25

Re: No GUI -> Start at login

string wrote:

How about something along the lines of (in /etc/rc.local):

.. or somesuch. You'll find GNU Screen in "extra" -- also, `man screen` would be a good idea at this point.

Sounds like an interesting idea. I might take a look at it if fukawi2's idea doesn't work. Is /etc/rc.local the place where i can put generic code to start at boot/login?


fukawi2 wrote:

Would an rc script be suitable so it could just be included in the DAEMONS array in rc.conf?

You can copy a template from /usr/share/pacman/rc-script.proto

Will this create a proper DAEMON script? If so, that is awesome, and something that I'd find quite useful. I take it I just put this file in the /etc/rc.d/ area to allow it to be executed on startup? Is there any way of associating a username with the executed DAEMON? Or does it run without a userID?

moljac024 wrote:

What about ~/.bash_profile ?

EDIT: That wouldn't work if you log into more TTY's.
You could use some simple bash scripts to see if the apps you want are running and if not, start them, otherwise do nothing.

~/.bash_profile sounds like a good one if it was a single user environment, though you are right, bash scripts would prevent multiple instances. I think I'll try the other ideas first though. I'll end up using ~/.bash_profile on my main computer (and probably my laptop), but for the server, fukawi2's idea about DAEMONizing things seems like the perfect solution.

Offline

#6 2008-11-19 01:51:46

fukawi2
Ex-Administratorino
From: .vic.au
Registered: 2007-09-28
Posts: 6,224
Website

Re: No GUI -> Start at login

zeddD1abl0 wrote:

Will this create a proper DAEMON script?

Yes smile

zeddD1abl0 wrote:

I take it I just put this file in the /etc/rc.d/ area to allow it to be executed on startup?

Yes smile  (And add to DAEMONS in rc.conf) (Don't forget to make it executable)

zeddD1abl0 wrote:

Is there any way of associating a username with the executed DAEMON? Or does it run without a userID?

The script itself will run as root, but you can use 'su - <USERNAME> -c' to run a specific command as a specific user. PostgreSQL requires this, have a look at the PostgreSQL rc script here http://pastebin.com/d7c0158d1

Last edited by fukawi2 (2008-11-19 01:53:33)

Offline

#7 2008-11-19 09:50:34

string
Member
Registered: 2008-11-03
Posts: 286

Re: No GUI -> Start at login

I can't say I use "nzbget" nor "rtorrent" so I'm not aware of (most of) their features. It would seem to me that the thing which makes fukawi2's suggestion an "unlikely solution" is the fact that those two programs don't run in `daemon mode`. I'm thinking it is the same as trying to have elinks or ncmpc start on boot.

I would not mind beeing wrong, naturally, but do you see what I'm trying to say fukawi2? The applications need to attach themselves to some sort of TTY upon startup.

Last edited by string (2008-11-19 09:52:31)

Offline

#8 2008-11-19 10:51:32

fukawi2
Ex-Administratorino
From: .vic.au
Registered: 2007-09-28
Posts: 6,224
Website

Re: No GUI -> Start at login

string wrote:

but do you see what I'm trying to say fukawi2?

Yep smile
But assuming that once they're configured, they can just start and do their thing, then they should be able to be started in the background...
/usr/bin/rtorrent & > /dev/null

It might work, it might not... I'm not familiar with either program either smile

Offline

#9 2008-11-19 11:30:50

string
Member
Registered: 2008-11-03
Posts: 286

Re: No GUI -> Start at login

Well it will work if the programs can be controlled "remotely" -- and it will force zeddD1abl0 to use the appropriate utilities rather than the rtorrent/nzbget user interfaces. Even if this is possible, in this particular scenario I'd still advocate using /etc/rc.local over writing custom init scripts.

zeddD1abl0: I forgot to tell you that: indeed, you can think of /etc/rc.local as a "script" which gets executed on boot. Its purpose is to give you an easy way to have various comands executed on boot. A possibly stupid but illustrative example:

#!/bin/bash
#
# /etc/rc.local: Local multi-user startup script.
#

echo "/etc/rc.local in action"

Last edited by string (2008-11-19 11:31:47)

Offline

#10 2008-11-21 14:49:51

zeddD1abl0
Member
Registered: 2008-07-10
Posts: 25

Re: No GUI -> Start at login

string wrote:

Well it will work if the programs can be controlled "remotely" -- and it will force zeddD1abl0 to use the appropriate utilities rather than the rtorrent/nzbget user interfaces. Even if this is possible, in this particular scenario I'd still advocate using /etc/rc.local over writing custom init scripts.

zeddD1abl0: I forgot to tell you that: indeed, you can think of /etc/rc.local as a "script" which gets executed on boot. Its purpose is to give you an easy way to have various comands executed on boot. A possibly stupid but illustrative example:

#!/bin/bash
#
# /etc/rc.local: Local multi-user startup script.
#

echo "/etc/rc.local in action"

Sorry it's taken so long to reply. Been a little busy lately.

I understand the example, do these processes run in the background? Will they restart for every user?

Background:

nzbget is a NewsBin program, used for downloading files from newsgroups. It has a simple interface (console based, no control issues there) and is easy to configure, Nothing too difficult, except it can't really be run simultaenously by 2 people, that would result in odd downloads.

rtorrent is a torrenting program that runs from the console, using console based commands. Same as above.

The reason I specifically want these two programs is so that I can just dump a file to the server, and then it will get downloaded when the program discovers it (about 5 mins). If you know of an easier way to do this, please tell me. Autostart without the Gnome "Sessions" menu is confusing for a newbie.

zeddD1abl0


So it turns out I should pay a little bit of attention when I do things. nzbget supports running as a daemon under a certain user. We can cross nzbget off the above list as i just shoved the startup into /etc/rc.local. Cheers string.

Last edited by zeddD1abl0 (2008-11-21 15:26:18)

Offline

Board footer

Powered by FluxBB