Spawning a shell script


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Spawning a shell script
# 1  
Old 11-18-2004
Tools Spawning a shell script

Hi there,

I have a shell script which I need to run it from two different places on the same server, are there any specific rules I need to apply? What is the best practice to achieve this task.

Regards
# 2  
Old 11-18-2004
It depends on what script does ;
What resources (files,databases .... etc ) the script access
# 3  
Old 11-23-2004
Tools Spawning a shell script

Quote:
Originally posted by bhargav
It depends on what script does ;
What resources (files,databases .... etc ) the script access
Hi bhargav,

Let's assume a very simple unix script that runs few unix commands, lik edf -k, ps -ef, etc...

Regards
# 4  
Old 11-23-2004
If you ran ps -ef, it would not matter where you were (present working directory) - it still gives the same output.

If you are looking for where you should put the script so it's in your PATH, then check your PATH with
$ echo $PATH

Normally, there is a certain directory folks use (according to how they were taught usually) - /usr/local or /opt/local may be set up in your environment. Putting your script into /usr/local/bin or /usr/local/scripts may suffice.
# 5  
Old 11-23-2004
Absolute and relative path for directoroes anf files:

a).Be sure to use absolute PATHs for directories/files instead of relative PATHS in the scirpt.

b).Do n't use absolute PATH in case you are saving some data into the files or creating temp files and making use of them in the flow of the script.

For temp savings it should be good idea to use relative directories
because u want to run the script from 2 different places at the same time.

c).And as RTM said... u should have the same env (PATH .. etc )settings in both the places before running the script to get the same results.
# 6  
Old 11-24-2004
Spawning a shell script

Quote:
Originally posted by bhargav
Absolute and relative path for directoroes anf files:

a).Be sure to use absolute PATHs for directories/files instead of relative PATHS in the scirpt.

b).Do n't use absolute PATH in case you are saving some data into the files or creating temp files and making use of them in the flow of the script.

For temp savings it should be good idea to use relative directories
because u want to run the script from 2 different places at the same time.

c).And as RTM said... u should have the same env (PATH .. etc )settings in both the places before running the script to get the same results.
The idea is to simulate unix operation, if many users type the command ls, many output will be displayed for all the users.

I want to do something similar.

Regards
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Spawning a TTY shell

Hi there, I would like to understand the purpose of spawning a TTY shell? Does it mean that it will help to open up a new Windows on the current interactive shell such that when the session gets lost the other won't Any explanation will be helpful. (3 Replies)
Discussion started by: alvinoo
3 Replies

2. Solaris

Script on Solaris spawning 2 processes for one shell script execution

Hi, I am having a shell script on Solaris 10 which has a while loop as shown below. #!/usr/bin/ksh # while do sleep 60 done Name of the shell script is coldcentric.sh. I executed script /DATAWAREHOUSE/LOAD/Scripts/coldcentric.sh from a command task in Informatica worklow as... (3 Replies)
Discussion started by: chekusi
3 Replies

3. Shell Programming and Scripting

Shell script executed from Informatica ETL tool is spawning 2 processes for one script

Hi, I am having a shell script which has a while loop as shown below. while do sleep 60 done I am executing this script from Informatica ETL tool command task from where we can execute UNIX commands/scripts. When i do that, i am seeing 2 processes getting started for one script... (2 Replies)
Discussion started by: chekusi
2 Replies

4. Shell Programming and Scripting

lost the $ prompt - am I spawning shells??

When trying to get the correct syntax to cron a script that creates a file with the date stamp as its output, sometimes I get these results: - from the command line, I may encounter an error that leaves me without the usual $ prompt. Am I in a new shell? I try to exit it with 'exit' or :q! and... (1 Reply)
Discussion started by: landog
1 Replies

5. UNIX for Advanced & Expert Users

Crontab spawning multiple at processes

Hi - I need help. My user crontab is spawning multiple at processes (and multiple mencoder program starts, that exit, then restart, repeatedly), locking up my system. For example I have this entry in my crontab: $ sudo crontab -u victoria -e * * * * * ~/recordings/pvr1 * * * * *... (10 Replies)
Discussion started by: gstuart
10 Replies

6. Shell Programming and Scripting

Spawning multiple threads in Unix

Hi, I need to spawn mutilpe threads , each invoking a different set of shell scripts, in parallel. What would be the best way to do that. Any sample script would greatly help. I am a novice at Unix so any help is much appreciated. Thanks (5 Replies)
Discussion started by: neeto
5 Replies

7. Programming

spawning multiple processes spread across two files

I want to spawn n child processes but have two different classes..with the foremost one forking/spawning the child process and the latter performing a function w/ the spawned processes. I can do this in one class with an if statement and the simple if((pid=fork())==0) //child process { ... (1 Reply)
Discussion started by: StrengthThaDon
1 Replies

8. UNIX for Advanced & Expert Users

spawning the same program

We have a program (reader) that reads audio files in a real-time continuous stream from a sender program. If the reader gets weird we want the sender to be able to send one command that will stop the current reader and start a new one that will be able to continue reading in the files. The sender... (9 Replies)
Discussion started by: laforge
9 Replies

9. Shell Programming and Scripting

Spawning new shells from the command line in OpenStep 4.2

Hi all, Im trying to figure out what the command would be to launch terminal windows from the command line in Open Step 4.2 . (looking for something similiar like /usr/bin/xterm or /usr/bin/dtterm etc) echo $TERM = vt100 echo $SHELL = /bin/csh Im combing over alot of OpenStep 4.2 and... (3 Replies)
Discussion started by: Rocketman8541
3 Replies

10. Solaris

spawning new shells using dtterm in Solaris 8

Hi all, First time poster here. Great forum. Im trying to spawn new shells and pass commands to the new shells in a solaris 8 environment utilizing dtterm and its option -e. I can successfully spawn a window utilizing the following code: /usr/dt/bin/dtterm -display <ip.address> & ... (4 Replies)
Discussion started by: Rocketman8541
4 Replies
Login or Register to Ask a Question