Creating multiple sessions


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Creating multiple sessions
# 1  
Old 04-07-2006
Question Creating multiple sessions

I have a program which gets an input file (which contain a list of objects) and processes the objects one by one sequentially. However when there are many objects it is faster to split the input into smaller lists and run the program in multiple terminal sessions simultaneously. I want to know if it's possible to create a K Shell which will open multiple sessions automatically (possibly in the background) to run multiple sessions of the program simultaneously.

Any help will be appreciated.

Steve
# 2  
Old 04-07-2006
Hi,
I think you could use XTerm command.
For exemple, I use the following syntax to open with vi the file <my_file> at line <my_line> on the server <hostname> in background (&) :
/usr/openwin/bin/xterm -bg white -fg black -bd white -bw 5 -sl 200 -title <title> -n <hostname> -geometry 132x50 -e vi +<my_line> <my_file> &

Regards
Mathieu
# 3  
Old 04-07-2006
Here is an overly simple example in ksh:

Code:
#!/bin/ksh
while read object
do

   nohup /path/to/my/prog "$object"  &

done < /path/to/inputfile
wait

You need to decide whether you want nohup in there. Or not.

If you have lots of objects this is a terrible idea - each process is expensive in terms of resources - you should look into threading your app instead.

We have boxes with 12 cpus and often iterate 12 "threads" of the same code to work
in parallel somewhat like this. It cuts processing time for us by a factor of 10-12 to do the parallel thing - if you have the resources.
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Sessions across multiple scripts.

I wish to be able to pass PHP values between multiple scripts. In each script, I have the following before any HTML code: <?php session_start(); session_name("STORE"); session_set_cookie_params( 'lifetime', '/var/www' ); session_id('Gingy'); ... (1 Reply)
Discussion started by: Meow613
1 Replies

2. Red Hat

multiple ssh sessions

Hi, I use OpenSSH to log on to a RH server but when I enter the password 2 session windows appear. I only need one so can anyone advise where I can rectify this? R, D. (2 Replies)
Discussion started by: Duffs22
2 Replies

3. AIX

Multiple sessions with xming

Hi. I installed xming to access to my servers but I have a problem : i can only have one session at a time ... i don't find any parameter to change this. Tks (3 Replies)
Discussion started by: stephnane
3 Replies

4. Programming

Creating Multiple Processes

I am having problems creating multiple forks. I want create a certain number of forks, each call a program and each wait for a different value. How is this accomplished my loop is not doing the trick. for (i = 0; i < 5; i++) { if (fork() < 0) { //print error } ... (3 Replies)
Discussion started by: Vikings1201
3 Replies

5. Shell Programming and Scripting

Creating multiple extensions

Friends I want to automat sending a letter to different persons whose directories are named as 001, 002, 003, 004. To push the same letter to all these directories, I need to name the letter as letter.001, letter.002 like that. Is there any method whereby I get the extension of this letter... (2 Replies)
Discussion started by: chssastry
2 Replies

6. UNIX for Advanced & Expert Users

Multiple Sessions with FTAM

Just a quick question, Can I establish Multiple Sessions between two machines using FTAM? Regards, Gaurav Goel (0 Replies)
Discussion started by: gauravgoel
0 Replies

7. Shell Programming and Scripting

creating multiple links with ln

I want to make a symbolic link to a set of files in a particular directory if they exist. The number of files in the set is not known. The following script fails because it is ambigious. if(-f dir1/*.a) then ln -s dir1/*.a dir2/ endif Can anyone help me? Thanks a lot. (1 Reply)
Discussion started by: Deanne
1 Replies

8. AIX

Locking a file when using VI to prevent multiple-edit sessions by diff users

At the office, we often have to edit one file with VI. We are 4-6 workers doing it and sometimes can be done at the same time. We have found a problem and want to prevent it with a file lock. Is it possible and how ? problem : Worker-a starts edit VI session on File-A at 1PM Worker-b... (14 Replies)
Discussion started by: Browser_ice
14 Replies

9. Solaris

Restricting Multiple loggin sessions

Any idea as to how multiple loggin sessions by the same user (using Hyper terminal/Telnet) be restricted in Sun Solaris 8. Rgds Naushi (10 Replies)
Discussion started by: Naushi
10 Replies

10. Shell Programming and Scripting

Multiple PHP sessions within the same browser instance

Dear all..... I am currently writing a Help-Desk / Knowledge Base application using PHP/PostGreSQL. I authenticate the user using a quite elaborate mechanism of cookies. The problem is that using cookies (I also have a version using sessions with the same problem), I can only seem to get one... (4 Replies)
Discussion started by: zazzybob
4 Replies
Login or Register to Ask a Question