You are not logged in.

#1 2009-04-21 20:13:57

wirefish
Member
Registered: 2009-04-21
Posts: 3

Running a script at boot that requires user input!

Hello all,
I am trying to run a script at boot that does some commands. They need a password however, I tryed putting it into /etc/rc.d/rc.local and it just ran by it not allowing me to enter a password?

Any tips for this?
Thanks allot.

Offline

#2 2009-04-22 10:29:48

deej
Member
Registered: 2008-02-08
Posts: 395

Re: Running a script at boot that requires user input!

This may help:

http://ubuntu.wordpress.com/2005/09/07/ … at-bootup/

... especially the comments section ( su -c joe user  )

Deej

Offline

#3 2009-04-22 15:54:03

wirefish
Member
Registered: 2009-04-21
Posts: 3

Re: Running a script at boot that requires user input!

Yes the password is actually to decrypt a gpg key so in this case the su -c command cannot work, Thanks allot for the help though deej. My fault for not specifying!

Offline

#4 2009-04-22 16:32:13

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

Re: Running a script at boot that requires user input!

That is odd. rc.multi runs rc.local and inittab runs rc.multi as 'wait' (man inittab). What does your /etc/inittab say?

Offline

#5 2009-04-22 18:37:38

wirefish
Member
Registered: 2009-04-21
Posts: 3

Re: Running a script at boot that requires user input!

#
# /etc/inittab
#

#  Runlevels:
#    0    Halt
#    1(S)    Single-user
#    2    Not used
#    3    Multi-user
#    4    Not used
#    5    X11
#    6    Reboot

## Only one of the following two lines can be uncommented!
# Boot to console
id:3:initdefault:
# Boot to X11
#id:5:initdefault:

rc::sysinit:/etc/rc.sysinit
rs:S1:wait:/etc/rc.single
rm:2345:wait:/etc/rc.multi
rh:06:wait:/etc/rc.shutdown
su:S:wait:/sbin/sulogin -p

# -8 options fixes umlauts problem on login
c1:2345:respawn:/sbin/agetty -8 38400 vc/1 linux
c2:2345:respawn:/sbin/agetty -8 38400 vc/2 linux
c3:2345:respawn:/sbin/agetty -8 38400 vc/3 linux
c4:2345:respawn:/sbin/agetty -8 38400 vc/4 linux
c5:2345:respawn:/sbin/agetty -8 38400 vc/5 linux
c6:2345:respawn:/sbin/agetty -8 38400 vc/6 linux

ca::ctrlaltdel:/sbin/shutdown -t3 -r now

# Example lines for starting a login manager
x:5:respawn:/usr/bin/xdm -nodaemon
#x:5:respawn:/usr/sbin/gdm -nodaemon
#x:5:respawn:/usr/bin/kdm -nodaemon
#x:5:respawn:/usr/bin/slim >& /dev/null

# End of file


Those are the contents. Thanks

Offline

#6 2009-04-22 18:45:40

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

Re: Running a script at boot that requires user input!

Maybe init runs it in a weird way? (like without stdin) It's kind of hard to test it. Maybe you can use openvt to launch the command.

Offline

Board footer

Powered by FluxBB