Commands in background in a script


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Commands in background in a script
# 1  
Old 05-20-2009
Commands in background in a script

Hi,

I was writing a script for backup,however i stumbled upon this.( As i mentioned in my earlier posts iam a beginner in shell scripting).

Here is a piece of code

case $DB_STAT in

OFFLINE)

echo "Service $SID currently $DB_STAT"

/usr/local/bkps/flash_filesystems $SAVE $SID 2> $LOGF


;;

so here iam tring to run the command /usr/local/bkps/flash_filesystems $SAVE $SID in background and the value of $SAVE is a command (savefs).

i tried

(( /usr/local/bkps/flash_filesystems $SAVE $SID)) & 2>$LOGF
tried with ()

is there any way where in i can run it in background with in the script
# 2  
Old 05-20-2009
Quote:
Originally Posted by maverick_here
Hi,

I was writing a script for backup,however i stumbled upon this.( As i mentioned in my earlier posts iam a beginner in shell scripting).

Here is a piece of code

When you post code, please wrap it in [code] tags.
Quote:
Code:
case $DB_STAT in

    OFFLINE)

        echo "Service $SID currently $DB_STAT"

        /usr/local/bkps/flash_filesystems $SAVE $SID 2> $LOGF
        

 ;;

so here iam tring to run the command /usr/local/bkps/flash_filesystems $SAVE $SID in background and the value of $SAVE is a command (savefs).

i tried

(( /usr/local/bkps/flash_filesystems $SAVE $SID)) & 2>$LOGF
tried with ()

is there any way where in i can run it in background with in the script

Code:
/usr/local/bkps/flash_filesystems "$SAVE" "$SID" 2>$LOGF &

Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Interactive script with background

I have script, which need some variable from user and i use below command for this read this script works fine while running without background, but when i run this script in background, it ask first variable then immediately it show below error KSH variable not found please let me... (1 Reply)
Discussion started by: pallvi_mahajan
1 Replies

2. Shell Programming and Scripting

Shell Script for continuously checking status of a another script running in background, and immedia

Hi, I want to write a script which continuously checking status of a script running in background by nohup command. And if same script is not running then immediately start the script...please help.. i am using below command to run script nohup system_traps.sh & but in some... (9 Replies)
Discussion started by: ketanraut
9 Replies

3. Shell Programming and Scripting

Running two commands in background

Hi I want to run two commands in background, i am using below way, but it is not working, i m calling these two commands from one script to another server where below commands are running, in my script ssh is working fine, but command is not going in background, please advise what should i do. ... (10 Replies)
Discussion started by: learnbash
10 Replies

4. Shell Programming and Scripting

snoop script in background

Hi I want to write a script for snoop which can do snoop for 30 min and then process should be killed automatically I am using below codes #!/usr/bin/ksh snoop -d igb0 -o /opt/temp/abc.pcap sleep 1500 kill -9 `ps -ef|grep -i snoop |grep -v grep|awk '{print $2}'` But process is not... (3 Replies)
Discussion started by: anish19
3 Replies

5. UNIX for Advanced & Expert Users

Where can I read about what happens when running commands in background

I want to know what happens when you run a shell builtin or an external script, vs an external binary. For example: ls uses stat() etc... with details that are as simple as possible, I am not a programmer, I am a sys admin. (3 Replies)
Discussion started by: glev2005
3 Replies

6. Shell Programming and Scripting

running the script in background

I have a script called startWebLogic.sh which I was running in the background but the problem is which I used the command :- ps -elf | grep "startWebLogic.sh" | grep -v grep to find the process id but I was unable to find the process id for this script and when I checked from the front end the... (3 Replies)
Discussion started by: maitree
3 Replies

7. Shell Programming and Scripting

Problem running a program/script in the background from a script

Hi all, I have a script that calls another program/script, xxx, to run in the background. Supposedly this program at most should finish within five (5) minutes so after five (5) minutes, I run some other steps to run the script into completion. My problem is sometimes the program takes... (5 Replies)
Discussion started by: newbie_01
5 Replies

8. Shell Programming and Scripting

Running a unix script(which is calling another script inside that) in background

Hi all, I am having a script ScriptA which is calling a script ScriptB in the same server and copying files to second server and have to execute one script ScriptC in the second server. THis First script ScriptA is the main script and i have to execute this process continously. for Keeping... (2 Replies)
Discussion started by: rohithji
2 Replies

9. UNIX for Dummies Questions & Answers

Executing a sequence of commands as a single background process

I'm writing a PHP script which will take a given media file and convert it into a flash (flv) file. In addition to this, once the flv file has been generated I create two thumbnails (of different sizes) from the newly generated flv file. In order to do this I'm calling ffmpeg from the command... (4 Replies)
Discussion started by: phatphug
4 Replies

10. Shell Programming and Scripting

Background shell script

I have a friend at work that asked me a question today and I figured I would seek help here. How does a shell script know whether it is running in the background or not? Thanks in advance for help (5 Replies)
Discussion started by: Moofasa
5 Replies
Login or Register to Ask a Question