Script Exection in Background


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Script Exection in Background
# 1  
Old 01-06-2007
Script Exection in Background

Below is my process monitor script. if i execute my script in foreground it works fine..but if i run in background it fails. why?

Last edited by Krrishv; 01-07-2007 at 01:50 PM..
# 2  
Old 01-06-2007
For one thing you should have a 1st line something like:
#! /usr/bin/ksh
we have a faq article that explains why. What does "fails" mean? Tell us precisely what does happen. (Would you email a mechanic, "hey my car doesn't work...what's wrong with it?")
# 3  
Old 01-07-2007
Thanks for your reply.

I used some mailx instead of elm now my script is working in background.

But i still need some help. if i exit my terminal session the script also exits which i dont want to do. Could you please let me know how do i make the script running even though i exit from terminal. Please help gurus.

Last edited by Krrishv; 01-07-2007 at 12:44 PM..
# 4  
Old 01-07-2007
man nohup (info nohup)
#nohup ./your_script >>/dev/null (or some other place you want logs to be) &
# 5  
Old 01-07-2007
Thanks it works perfect.

Last edited by Krrishv; 01-07-2007 at 02:17 PM..
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. 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

2. 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

3. 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

4. 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

5. UNIX for Advanced & Expert Users

Running script in background

When I run the following snippet in background #!/bin/ksh while do echo "$i" sleep 10 i=`expr $i + 1` done My job got stopped and it says like + Stopped (SIGTTOU) ex1 & I did "stty tostop" as suggested in many of the post but still not working... (3 Replies)
Discussion started by: shahnazurs
3 Replies

6. Shell Programming and Scripting

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" ... (1 Reply)
Discussion started by: maverick_here
1 Replies

7. UNIX for Dummies Questions & Answers

Running the Script in Background.

Gurus, Pls. help on this to run the script in background. I have a script to run the informatica workflows using PMCMD in script. Say the script name is test.sh & Parameters to the script is Y Y Y Y The no of parameters to the bove script is 4. all are going to be a flags. Each flag will... (2 Replies)
Discussion started by: prabhutkl
2 Replies

8. Shell Programming and Scripting

Background execution of a script

Hi All, Have a script called FTPIN-xx.sh. It does stuff and when all is done, it is to execute another. However, I'd like to have it execute the second script in the background or in a fashion that would allow my script to complete without having to wait. I'm robbing the command from how I... (2 Replies)
Discussion started by: Cameron
2 Replies

9. Shell Programming and Scripting

how to run script at background

Hi all, I have a script like: echo Please input list file name: read listn for file in `cat $listn.txt` do send_file $file done normally, I will run the script like: :. resendfile Please input list filename: list1 #Then, the script will resend all file from the list1. However,... (4 Replies)
Discussion started by: happyv
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