Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
[SOLVED]Can't run commands usign agetty and inittab
View unanswered posts
View posts from last 24 hours
View posts from last 7 days

 
Reply to topic    Gentoo Forums Forum Index Desktop Environments
View previous topic :: View next topic  
Author Message
danielhilst
n00b
n00b


Joined: 19 Feb 2011
Posts: 35

PostPosted: Mon Apr 01, 2013 12:52 am    Post subject: [SOLVED]Can't run commands usign agetty and inittab Reply with quote

How can I run commands on a specifi tty using agetty, here is the snippet on my inittab that sould do the tricky but I just don't start

Code:
# TERMINALS
c1:12345:respawn:/sbin/agetty 38400 tty1 linux   
c2:2345:respawn:/sbin/agetty 38400 tty2 linux
c3:2345:respawn:/sbin/agetty 38400 tty3 linux
c4:2345:respawn:/sbin/agetty 38400 tty4 linux
c5:2345:respawn:/sbin/agetty 38400 tty5 linux
c6:2345:respawn:/sbin/agetty 38400 tty6 linux   
c9:2345:respawn:/sbin/agetty  --noclear -l /usr/bin/top 38400 tty9 linux
c10:2345:respawn:/sbin/agetty --noclear -l "/usr/bin/vmstat 1"  38400 tty10 linux
c11:2345:respawn:/sbin/agetty --noclear -l "/usr/bin/iostat -dmx 1"  38400 tty11 linux


I want top, vmstat and iostat running before I login, on ttys 9 to 11,

Any idea?
_________________
"Do or do not, there is no try" Yoda Master


Last edited by danielhilst on Tue Apr 16, 2013 12:23 pm; edited 1 time in total
Back to top
View user's profile Send private message
eccerr0r
Watchman
Watchman


Joined: 01 Jul 2004
Posts: 9645
Location: almost Mile High in the USA

PostPosted: Mon Apr 01, 2013 4:05 pm    Post subject: Reply with quote

Getty is used to get login information for login, since you're not trying to login to those terminals you don't need to use getty.

I'd probably not bother running it in inittab and run these programs in the background in /etc/local.d/local.start though 'top' would be a special case (the other two will work as-is).

top is a special case as it's interactive... Also has some security implications so definitely would need some thought into this before deploying... You could use this with agetty with -a autologin with an unprivileged account (made just for 'top') that has a .bashrc or other login script to start top. But even this has security implications...
_________________
Intel Core i7 2700K/Radeon R7 250/24GB DDR3/256GB SSD
What am I supposed watching?
Back to top
View user's profile Send private message
danielhilst
n00b
n00b


Joined: 19 Feb 2011
Posts: 35

PostPosted: Tue Apr 16, 2013 12:23 pm    Post subject: Reply with quote

eccerr0r wrote:
Getty is used to get login information for login, since you're not trying to login to those terminals you don't need to use getty.

I'd probably not bother running it in inittab and run these programs in the background in /etc/local.d/local.start though 'top' would be a special case (the other two will work as-is).

top is a special case as it's interactive... Also has some security implications so definitely would need some thought into this before deploying... You could use this with agetty with -a autologin with an unprivileged account (made just for 'top') that has a .bashrc or other login script to start top. But even this has security implications...

I tryied -a withou success..

The solutions was this..
Code:
c9:2345:respawn:/usr/bin/top >/dev/tty9 2>/dev/tty9 </dev/tty9


My problem was, I have a heavy I/O blocking login, so when I enter root I has to wait about 10 secs before get prompted for root.. and when I finally login the I/O has gone.. So I need start top prior login.

I just put it there, get what was causing that I/O (was some btrfs cache processes) ... then remove the above inittab line

Cheers
_________________
"Do or do not, there is no try" Yoda Master
Back to top
View user's profile Send private message
eccerr0r
Watchman
Watchman


Joined: 01 Jul 2004
Posts: 9645
Location: almost Mile High in the USA

PostPosted: Tue Apr 16, 2013 12:41 pm    Post subject: Reply with quote

I think you misunderstood the intent of using -a and using a regular user.

The problem is if someone was at your console and hit alt-f9, k 1 [enter] 1 [enter], your machine would come crashing down because top is running as root ... it's a security hole...

Granted this is not the only way to solve the problem, you could also use su to change the user in inittab too...
_________________
Intel Core i7 2700K/Radeon R7 250/24GB DDR3/256GB SSD
What am I supposed watching?
Back to top
View user's profile Send private message
danielhilst
n00b
n00b


Joined: 19 Feb 2011
Posts: 35

PostPosted: Wed Apr 17, 2013 3:19 pm    Post subject: Reply with quote

eccerr0r wrote:
I think you misunderstood the intent of using -a and using a regular user.

The problem is if someone was at your console and hit alt-f9, k 1 [enter] 1 [enter], your machine would come crashing down because top is running as root ... it's a security hole...

Granted this is not the only way to solve the problem, you could also use su to change the user in inittab too...


I understand, but I telling you, I just put that line there.. get the process causing I/O and then remove the line. Is my notebook, not a production environment..
_________________
"Do or do not, there is no try" Yoda Master
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Desktop Environments All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum