LinuxQuestions.org
Visit Jeremy's Blog.
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 10-31-2005, 01:22 PM   #16
Quigi
Member
 
Registered: Mar 2003
Location: Cambridge, MA, USA
Distribution: Ubuntu (Dapper and Heron)
Posts: 377

Rep: Reputation: 31

Again, what's the purpose of xterm? I personally would avoid it.
 
Old 10-31-2005, 01:26 PM   #17
Kalyani1
Member
 
Registered: Oct 2005
Posts: 43

Original Poster
Rep: Reputation: 15
How to Run 3 Scripts at a time in Linux using script.

Thanks,
kal
 
Old 10-31-2005, 01:28 PM   #18
Kalyani1
Member
 
Registered: Oct 2005
Posts: 43

Original Poster
Rep: Reputation: 15
I like to do the same terminal.

My manager doesn't want to do the same terminal.
 
Old 10-31-2005, 01:48 PM   #19
Quigi
Member
 
Registered: Mar 2003
Location: Cambridge, MA, USA
Distribution: Ubuntu (Dapper and Heron)
Posts: 377

Rep: Reputation: 31
To run three scripts in parallel,
Code:
script0.sh&
script1.sh&
script2.sh&
The ampersand makes a background job. The script will start all three scripts and return immediately. Caution: None of the scripts should need the results/effects of the other scripts, and they shouldn't write to the same file, otherwise you have a "race condition", which is virtually always a bad thing. If script1.sh must not run until script0.sh has run, e.g., because script0.sh mounts /filesrv and script1.sh uses that filesystem, they must be run sequentially, e.g.,
Code:
script0.sh
script1.sh
You could put an ampersand after script1.sh, so it gets started in the background (but still after script0.sh completes).
 
Old 10-31-2005, 01:53 PM   #20
Quigi
Member
 
Registered: Mar 2003
Location: Cambridge, MA, USA
Distribution: Ubuntu (Dapper and Heron)
Posts: 377

Rep: Reputation: 31
P.S.: You won't have job control for background jobs started in the script. They will be jobs of the subshell that executes the scripts, and when the script completes and the subshell exists, they orphan, and init adopts them.

Job control only works for jobs started by your (interactive) shell. If that's a problem, you could source the script instead of executing it.
 
Old 10-31-2005, 04:57 PM   #21
Kalyani1
Member
 
Registered: Oct 2005
Posts: 43

Original Poster
Rep: Reputation: 15
Hi Quizi,

It's working fine. Appreciated your help.
 
Old 10-31-2005, 05:28 PM   #22
Kalyani1
Member
 
Registered: Oct 2005
Posts: 43

Original Poster
Rep: Reputation: 15
How to put this script ("automnt.sh") into startup file called .bash_profile, the script should run as soon as you logon to system.

Thanks
 
Old 10-31-2005, 08:29 PM   #23
Quigi
Member
 
Registered: Mar 2003
Location: Cambridge, MA, USA
Distribution: Ubuntu (Dapper and Heron)
Posts: 377

Rep: Reputation: 31
You could just add a line with the command.

Potential problems:
* If it's not in your path or PATH, you must specify a path, absolute or relative. E.g., these days most people don't have "." (the current directory) in their path any more as it's considered unsafe. Hence even if automnt.sh is in your home directory, "automnt.sh" won't be found. But "./automnt.sh" will.
* If you implemented it with xterms, you are dependent on X11 being available. (If your manager made you do it, blame it on him :-) ) This can fail for many reasons. E.g., if your machine is booted into runlevel 3 (by default, or just one fine day), you log in on a text interface, and there's no X. If you log in on a virtual terminal, to which you switch by pressing C-M-F1 (hold Ctrl and Alt, and push F1) etc, you don't have X either. When you log in remotely using ssh -x, X won't be forwarded (conversely ssh -X explicitly requests X forwarding). In all those circumstances, xterm will complain it cannot open dislay, and exit.
* If the script doesn't complete immediately, it makes you wait when you log in before you get a prompt. If you followed what you sketched above and started all subordinate scripts in parallel, you're fine. Otherwise you can run the script in the background. E.g., if it's in ~/script, put "script/automnt.sh &" into your profile.
* If you log in several times into the same machine, the script may run when it shouldn't. E.g., mount will fail (with a harmless warning) if the volume is already mounted.
* Regarding the name, note that "automounter" is a well-established concept. As I sketched earlier, it's something different.
 
Old 11-01-2005, 09:49 AM   #24
Kalyani1
Member
 
Registered: Oct 2005
Posts: 43

Original Poster
Rep: Reputation: 15
You want me to change "noauto" to "automounter" in etc/fstab.
 
Old 11-01-2005, 12:19 PM   #25
Kalyani1
Member
 
Registered: Oct 2005
Posts: 43

Original Poster
Rep: Reputation: 15
How to find .Xdefault file.

Thanks,
kal
 
Old 11-01-2005, 04:12 PM   #26
Quigi
Member
 
Registered: Mar 2003
Location: Cambridge, MA, USA
Distribution: Ubuntu (Dapper and Heron)
Posts: 377

Rep: Reputation: 31
Hi Kal,

No, I don't want you to change the "noauto" option in fstab. I'm just alerting you that the name you chose for your script may confuse others, because an automounter is a different thing.

If you have X defaults, the file is in your home directory and ends with an "s". Mine, for an example, is pretty short:
Code:
$ cat ~/.Xdefaults
Emacs*menubar*background: #b5cf7a
It's optional; if you don't have one, you may create it. But I digress.
 
Old 11-01-2005, 05:54 PM   #27
Kalyani1
Member
 
Registered: Oct 2005
Posts: 43

Original Poster
Rep: Reputation: 15
Thank you somuch.
 
Old 11-01-2005, 06:20 PM   #28
Kalyani1
Member
 
Registered: Oct 2005
Posts: 43

Original Poster
Rep: Reputation: 15
Hi Quizi,

I would like to change the colors to my X terminals. I Know You don't like the X terminals. All the time I am asking about X terminals. I created the Xdefaults file.
 
Old 11-02-2005, 11:04 AM   #29
Quigi
Member
 
Registered: Mar 2003
Location: Cambridge, MA, USA
Distribution: Ubuntu (Dapper and Heron)
Posts: 377

Rep: Reputation: 31
I like xterm. I use them all the time. But relying on X windows in a situation like mounting a filesystem makes for a script that's less robust than necessary.

You say you created the Xdefaults file (note that it should start with a period). Does it do what you want?

Tell us more about changing "colors to" your X terminals. There are many ways in which you can change colors, starting with
Quote:
-cr color
This option specifies the color to use for text cursor.
(From xterm(1))
 
Old 11-02-2005, 11:30 AM   #30
Kalyani1
Member
 
Registered: Oct 2005
Posts: 43

Original Poster
Rep: Reputation: 15
Hi,

My code is:

xterm -e mount /filesrv
xterm -e /root/parameters/param.sh &
xterm -e /root/parameters/Releasechecker.sh&
xterm -e /root/parameters/prnscript/makePRN.sh&

1. This script works Very good, But I am getting 6 screens instead of 3 . In 6 screens 3 are fine and the other 3 getting Prompt sign.

2. I created a .Xdefaults file (I don't know what extension is) in the home Directory.

cat > .Xdefaults

Emacs*menubar*background: #b5cfda

The three terminals text color is White. I want to change the Text color green or whatever.
 
  


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
Automatic mount steelneck Linux - Software 2 11-26-2005 11:39 AM
automatic mounting and write acces oldforce Ubuntu 2 04-19-2005 04:51 PM
Can't WRITE to USB stick, Mount OK NO WRITE! ClericPreston Linux - Newbie 4 12-04-2004 10:43 AM
send automatic input to a script called by another script in bash programming jorgecab Programming 2 04-01-2004 12:20 AM
HELP! Error from mount: drive is write-protected... won't mount writeable. system Linux - General 2 12-27-2001 09:08 PM

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

All times are GMT -5. The time now is 05:28 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