Sponsored Content
Top Forums Shell Programming and Scripting How to monitor a shell script called within a script? Post 302845815 by chatwithsaurav on Thursday 22nd of August 2013 10:39:26 AM
Old 08-22-2013
How to monitor a shell script called within a script?

HIi Guys... I am in a fix.... 1st the code :

Script 123.sh looks like this :

Code:
./abc # a script which is getting called in this script
while true
do
     count=`ps -ef | grep abc | wc -l`
     if [ $count -gt 1]
     echo "abc is running
     sleep 10
     fi
done

but the process is getting checked only after ./abc is getting finished.... Smilie

is there any command or a way in which I can parallely check the abc process within 123.sh?

Please help me out!!!!

Last edited by Scott; 08-22-2013 at 11:40 AM.. Reason: Please use code tags
 

9 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

gzip in shell script called by cron

I'm puzzled by this one. I hope you can explain it to me. I have a ksh shell script that gzips a file among other things. This works perfectly fine when the script is manually run through a shell. However, when the same script is run through cron, it does everything correctly, but it will... (2 Replies)
Discussion started by: hbau419
2 Replies

2. Shell Programming and Scripting

How to return the value from the called shell script to the calling sh script

Hi all, I have two ksh scripts #sample1.sh #!/bin/ksh . ./sample2.sh echo $fileExist #sample2.sh #!/bin/ksh func() { i=1 return $a } func echo $? Here how should I return the value of sample2.sh back to sample1.sh? Thanks in advance. (2 Replies)
Discussion started by: gp_singh
2 Replies

3. Shell Programming and Scripting

environment variable in shell script called through crontab

Please help me on below.. https://www.unix.com/shell-programming-scripting/141533-retrieve-value-environment-variable-shell-script-called-crontab.html#post302442024 I'm still here. I can still see you! (0 Replies)
Discussion started by: jadoo_c2
0 Replies

4. UNIX for Dummies Questions & Answers

How to retrieve the value of variable in shell script which is called by crontab

There are two files one is shell script (sample.sh) and another is configuration file (sampl_conf.cfg) configuration file contains one variable $FTP_HOME. the value of this variable vaires for user to user. If user is say jadoo then value is /home/jadoo/ftp/, for user1 - /home/user1/ftp. The... (4 Replies)
Discussion started by: jadoo_c2
4 Replies

5. UNIX for Dummies Questions & Answers

Interpreting Shell Script errors when called from CRON

Hi All, I am calling a series of shell scripts via CRON so everything is running as root. However, in my error log file I am seeing the following errors. Please can anyone offer any advise as to the possible causes and solution to prevent the errors from appearing. The Error 1227 seems to... (2 Replies)
Discussion started by: daveu7
2 Replies

6. Shell Programming and Scripting

Python script called by a shell script

experts, i wrote a python script to do a certain job, i tried it and it is working fine, i want this script to be executed automatically after a ksh script, the problem is when i execute the ksh script my python script runes perfectly after the ksh script as I have include it at the end of the ksh... (1 Reply)
Discussion started by: q8devilish
1 Replies

7. Shell Programming and Scripting

Shell script to pass the config file lines as variable on the respective called function on a script

I want to make a config file which contain all the paths. i want to read the config file line by line and pass as an argument on my below function. Replace all the path with reading config path line by line and pass in respective functions. how can i achieve that? Kindly guide. ... (6 Replies)
Discussion started by: sadique.manzar
6 Replies

8. UNIX for Beginners Questions & Answers

How to pass values to a script called from within another script in shell?

Need ideas on how to achieve the below. We have a script say "profile.sh" which internally calls another existing script called "name.sh" which prompts for the name and age of a person upon execution. When i run profile.sh how can i populate a pre-defined value from another file and pass that... (1 Reply)
Discussion started by: sankasu
1 Replies

9. UNIX for Beginners Questions & Answers

How to pass values to a script called from within another script in shell?

Ceiling Light - The Forgotten Element One of the highest details concerning using an LED ceiling panel essentially offer a fantastic dance floor which definitely makes the customers dance right away.They are a quite low cost method of something like a lighting solution, simple collection up,... (1 Reply)
Discussion started by: harveyclayton
1 Replies
SCRIPT(1)						    BSD General Commands Manual 						 SCRIPT(1)

NAME
script -- make typescript of terminal session SYNOPSIS
script [-a] [-c COMMAND] [-e] [-f] [-q] [-t] [file] DESCRIPTION
Script makes a typescript of everything printed on your terminal. It is useful for students who need a hardcopy record of an interactive session as proof of an assignment, as the typescript file can be printed out later with lpr(1). If the argument file is given, script saves all dialogue in file. If no file name is given, the typescript is saved in the file typescript. Options: -a Append the output to file or typescript, retaining the prior contents. -c COMMAND Run the COMMAND rather than an interactive shell. This makes it easy for a script to capture the output of a program that behaves differently when its stdout is not a tty. -e Return the exit code of the child process. Uses the same format as bash termination on signal termination exit code is 128+n. -f Flush output after each write. This is nice for telecooperation: One person does `mkfifo foo; script -f foo' and another can super- vise real-time what is being done using `cat foo'. -q Be quiet. -t Output timing data to standard error. This data contains two fields, separated by a space. The first field indicates how much time elapsed since the previous output. The second field indicates how many characters were output this time. This information can be used to replay typescripts with realistic typing and output delays. The script ends when the forked shell exits (a control-D to exit the Bourne shell (sh(1)), and exit, logout or control-d (if ignoreeof is not set) for the C-shell, csh(1)). Certain interactive commands, such as vi(1), create garbage in the typescript file. Script works best with commands that do not manipulate the screen, the results are meant to emulate a hardcopy terminal. ENVIRONMENT
The following environment variable is utilized by script: SHELL If the variable SHELL exists, the shell forked by script will be that shell. If SHELL is not set, the Bourne shell is assumed. (Most shells set this variable automatically). SEE ALSO
csh(1) (for the history mechanism), scriptreplay(1). HISTORY
The script command appeared in 3.0BSD. BUGS
Script places everything in the log file, including linefeeds and backspaces. This is not what the naive user expects. AVAILABILITY
The script command is part of the util-linux package and is available from ftp://ftp.kernel.org/pub/linux/utils/util-linux/. Linux July 30, 2000 Linux
All times are GMT -4. The time now is 03:32 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy