Re: allow ^C to interrupt /etc/rc.local
OK, thanks everybody. I came up with a workaround since ^C doesn't interrupt: $ tail /etc/rc.local echo $0: Will execute \${program=/etc/init.d/nodm start}\ in ${seconds=5} seconds. Hit some chars and RET to cancel. Hit RET to start right away. for ((; seconds 0; seconds--)) do read -p $seconds.. -t 1 case $? in 0) #they hit RET... case $REPLY in '') break ;; #...with no other chars *) exit 44;; #...with other chars esac;; esac done echo running $program... $program -- To UNSUBSCRIBE, email to debian-user-requ...@lists.debian.org with a subject of unsubscribe. Trouble? Contact listmas...@lists.debian.org Archive: http://lists.debian.org/87ipw7w2om@jidanni.org
Re: allow ^C to interrupt /etc/rc.local
On Thursday 24 February 2011 00:56:55 jida...@jidanni.org wrote: OK, since nobody knows, then what does recovery mode, Oh, I'm betting someone knows and they either didn't get your message (because they aren't on the list) or didn't reply (because they didin't want to spend their time that way). /boot/grub/grub.cfg: menuentry 'Debian GNU/Linux, with Linux 2.6.37-1-686 (recovery mode)' do to the terminal in order to enable interaction after one enters the root passwd? It doesn't do anything special. /sbin/init runs /sbin/sulogin (which may or may not prompt for a pasword) on that vt. It does this because the single kernel command-line argument included in that menu entry has init start in the S runlevel. I'm not sure that /etc/rc.local is run with a controlling terminal. Sure, it's output appears on the console, but that can certainly be done without having a controlling terminal. If is doesn't have a controlling terminal, it is likely difficult to impossible to has it receive Ctrl+C, since some program attached to the terminal will swallow the key event (possibly, but not necessarily sending SIGINT to selected children as it does). -- Boyd Stephen Smith Jr. ,= ,-_-. =. b...@iguanasuicide.net ((_/)o o(\_)) ICQ: 514984 YM/AIM: DaTwinkDaddy `-'(. .)`-' http://iguanasuicide.net/\_/ signature.asc Description: This is a digitally signed message part.
Re: allow ^C to interrupt /etc/rc.local
Hi, On Thu, Feb 24, 2011 at 02:56:55PM +0800, jida...@jidanni.org wrote: OK, since nobody knows, then what does recovery mode, /boot/grub/grub.cfg: menuentry 'Debian GNU/Linux, with Linux 2.6.37-1-686 (recovery mode)' I think this put system to something like runlevel S or 1 do to the terminal in order to enable interaction after one enters the root passwd? When system goes though runlevel S, there is some SULOGIN things: $ grep -i login * S02early-readahead: if [ -d /proc/1 ] [ ! -e /proc/1/loginuid ]; then S08checkroot.sh:[ $SULOGIN ] || SULOGIN=no S08checkroot.sh:# Set SULOGIN in /etc/default/rcS to yes if you want a sulogin to S08checkroot.sh:[ $SULOGIN = yes ] sulogin -t 30 $CONSOLE S08checkroot.sh:if ! sulogin $CONSOLE S08checkroot.sh:if ! sulogin $CONSOLE S12checkfs.sh: if ! sulogin $CONSOLE S25bootmisc.sh:[ $DELAYLOGIN ] || DELAYLOGIN=yes S25bootmisc.sh: # If login delaying is enabled then create the flag file S25bootmisc.sh: # which prevents logins before startup is complete S25bootmisc.sh: case $DELAYLOGIN in S25bootmisc.sh: echo System bootup in progress - please wait /var/lib/initscripts/nologin S25bootmisc.sh: # Create /var/run/utmp so we can login. S25later-readahead: if [ -d /proc/1 ] [ ! -e /proc/1/loginuid ]; then S26stop-bootlogd-single:# a call to /sbin/sulogin, while runlevel 1 is a call to S26stop-bootlogd-single:# /sbin/sulogin. OK, I found S08checkroot.sh:[ $SULOGIN = yes ] sulogin -t 30 $CONSOLE It has comments: # Set SULOGIN in /etc/default/rcS to yes if you want a sulogin to # be spawned from this script *before anything else* with a timeout, # like sysv does. See sulogin(8). Cheers. Osamu -- To UNSUBSCRIBE, email to debian-user-requ...@lists.debian.org with a subject of unsubscribe. Trouble? Contact listmas...@lists.debian.org Archive: http://lists.debian.org/20110224144146.ga17...@debian.org
allow ^C to interrupt /etc/rc.local
Gentlemen, at the bottom of /etc/rc.local I have: echo $0: Will execute \${program=/etc/init.d/nodm start}\ in ${seconds=5} seconds. Hit ^C to cancel. Hit RET to start right away. for ((; seconds 0; seconds--)); do read -p $seconds.. -t 1 break; done echo running $program... $program The problem is of course that ^C is ignored when running /etc/rc.local . I have tried putting set -i, stty, trap '' INT, you name it, into /etc/rc.local . They all don't work. The best I can do is to type something and then a RET, and evaluate that, which is not as fun as ^C. -- To UNSUBSCRIBE, email to debian-user-requ...@lists.debian.org with a subject of unsubscribe. Trouble? Contact listmas...@lists.debian.org Archive: http://lists.debian.org/87ipwbnozb@jidanni.org
Re: allow ^C to interrupt /etc/rc.local
OK, since nobody knows, then what does recovery mode, /boot/grub/grub.cfg: menuentry 'Debian GNU/Linux, with Linux 2.6.37-1-686 (recovery mode)' do to the terminal in order to enable interaction after one enters the root passwd? -- To UNSUBSCRIBE, email to debian-user-requ...@lists.debian.org with a subject of unsubscribe. Trouble? Contact listmas...@lists.debian.org Archive: http://lists.debian.org/87ipw9rkco@jidanni.org