LinuxQuestions.org
Help answer threads with 0 replies.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices


Reply
  Search this Thread
Old 08-03-2009, 05:02 PM   #1
lothario
Member
 
Registered: Apr 2004
Posts: 340

Rep: Reputation: 30
prevent Ctrl-C while "~/.bashrc" is running


I have setup the "~/.bashrc" for a user and it is working fine.
It takes about 5 to 10 seconds to finish running because everytime the user logs in, it needs to fetch and process some data from a remote server.

So the user knows that he has to wait for about 5 to 10 seconds.

How can I prevent the user from doing Ctrl-C on the keyboard to abort this "~/.bashrc" prematurely?
 
Old 08-03-2009, 06:10 PM   #2
tcomputerchip
Member
 
Registered: Sep 2004
Location: LA,California
Distribution: FC4, FC5smp, REL4, REL5
Posts: 58

Rep: Reputation: 15
Quote:
Originally Posted by lothario View Post
I have setup the "~/.bashrc" for a user and it is working fine.
It takes about 5 to 10 seconds to finish running because everytime the user logs in, it needs to fetch and process some data from a remote server.

So the user knows that he has to wait for about 5 to 10 seconds.

How can I prevent the user from doing Ctrl-C on the keyboard to abort this "~/.bashrc" prematurely?

One way might be to remap Ctrl key to something else like spacebar before the script starts or at the top of your script. Then remap it back to what ever was the default...

I would start by looking at the Xdefaults file or the xmodmap command.

I think xmodmap can be run before the script and after the script, in theory you could remap all keys to spacebar, then load the default xmodmap when done.

This is how I setup kiosks.

-t
 
Old 08-03-2009, 08:54 PM   #3
chrism01
LQ Guru
 
Registered: Aug 2004
Location: Sydney
Distribution: Rocky 9.2
Posts: 18,359

Rep: Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751
Here are some simpler solns:
http://nixcraft.com/shell-scripting/...-c-ctrl-z.html
http://forums13.itrc.hp.com/service/...06208+28353475
 
Old 08-04-2009, 01:11 AM   #4
lothario
Member
 
Registered: Apr 2004
Posts: 340

Original Poster
Rep: Reputation: 30
Quote:
Originally Posted by chrism01 View Post
This one worked for me. Thanks.

Now that I have Ctrl-C taken care of.
Are there any other such gotchas that I should handle?
So that "~/.bashrc" does not get interrupted.
 
Old 08-04-2009, 07:41 PM   #5
chrism01
LQ Guru
 
Registered: Aug 2004
Location: Sydney
Distribution: Rocky 9.2
Posts: 18,359

Rep: Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751
As per those links, you can trap a lot of stuff (pretty much all the signals for a start), so http://en.wikipedia.org/wiki/Category:Unix_signals and re-read the links.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Hardy won't startup, stops with a "fail" and I have to "ctrl+alt+del" to boot. brjoon1021 Ubuntu 10 12-15-2008 06:29 PM
"GRUB _" when booting, nothing but "ctrl+alt+del" functions rabidpencil Linux - Newbie 15 08-08-2006 10:20 AM
learned "aliases", what are "functions" in .bashrc? learnfast Linux - Newbie 3 03-15-2005 04:24 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Software

All times are GMT -5. The time now is 10:29 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration