![]() |
|
|
google unix.com
|
|||||||
| Forums | Register | Forum Rules | Links | Albums | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
| Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts and shell scripting languages here. |
More UNIX and Linux Forum Topics You Might Find Helpful
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| URL call from SHELL script | chengwei | Shell Programming and Scripting | 37 | 04-15-2009 10:52 PM |
| Call shell script from php not run ? | raccsdl | Shell Programming and Scripting | 2 | 11-19-2007 08:21 AM |
| To call/execute a shell script from a shell script | konark | UNIX for Dummies Questions & Answers | 1 | 10-26-2007 06:16 PM |
| How to call a perl script from a shell script | anumkoshy | Shell Programming and Scripting | 2 | 08-30-2007 05:23 AM |
| exit a shell script!! | sami98 | Shell Programming and Scripting | 4 | 03-27-2007 05:55 AM |
![]() |
|
|
LinkBack | Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
|
||||
|
I have a shell script that calls another shell script "str_process_main" that runs in a loop until a given time. I want the first script to just call the second one and then exit. The first script is: Code:
#!/bin/ksh
DATE=$(date +%m%d%y)
DPID=$(ps -ef|grep str_process_main|grep -v grep)
if [ "${DPID}" = "" ]; then
cd /usr/local/wss_polling
str_process_main
echo "The process was not running."
else
echo "The process is already running: $DPID."
fi
exit
The first script just sits there and runs? |
|
||||
|
check it
just call the second script as
#!/bin/ksh DATE=$(date +%m%d%y) DPID=$(ps -ef|grep str_process_main|grep -v grep) if [ "${DPID}" = "" ]; then cd /usr/local/wss_polling . str_process_main echo "The process was not running." else echo "The process is already running: $DPID." fi exit note that the 2nd script is called using a dot (.) this dot notation runs the second script in the same shell ..i.e calling shell .. if u call it without using a dot ...then also the script will run ... but in a new shell ..( sub-shell) |
|
||||
|
run the script with nohup in background
#!/bin/ksh DATE=$(date +%m%d%y) DPID=$(ps -ef|grep str_process_main|grep -v grep) if [ "${DPID}" = "" ]; then cd /usr/local/wss_polling nohup str_process_main & echo "The process was not running." else echo "The process is already running: $DPID." fi exit |
![]() |
| Bookmarks |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|