I am having a problem getting the PID of a process I start in the background is a csh.
In tcsh and sh it's simple
$! give it to you
But in csh this just returns
Variable syntax
From the man page it should work but it doesn't????
Any help. (2 Replies)
Hi
I have the following piece of code that is calling another child process archive.ksh in the background
while read file;
do
file_name=`ls $file`;
ksh archive.ksh $file_name &;
done < $indirect_file
The problem is, indirect_file may contain anwhere from 2 to 20 different... (5 Replies)
Hello All,
I am a newbie in Shell script programming, and maybe you can help me with my query.
I need to write a shell script (mntServer.ksh) that will start a background process and also to be able to run another script.
The mntServer.ksh script contains:
#!/bin/ksh... (1 Reply)
Hi,
I have a process that I run in the background that looks like this
${BASEDIR}/ksh/sqler.ksh ${compnames003} &
and I would like to get the return code of the sqler.ksh script.
so my code is like this
${BASEDIR}/ksh/sqler.ksh ${compnames003} &
retcode=$? (3 Replies)
Hi all,
I'm reading <advanced bash scripting> and there is a example to kill a background process in a limited time,as shown below:
#! /bin/bash
#set -n
TIMEOUT=$1
count=0
hanging_jobs & {
while ((count < TIMEOUT));do
eval ' && ((count = TIMEOUT))'
((count++))
sleep 1... (6 Replies)
Hello All,
I was looking into creating a script that would be used only to start a Daemon and create a lock file...
F.Y.I. It's for Nagios' NRPE Daemon Plugin...
Anyway when I run the command to start the Daemon (below):
/usr/local/nagios/bin/nrpe -c /usr/local/nagios/etc/nrpe.cfg -d
And... (14 Replies)
Hi all, i hava a specific backgroud process. I have de PID of this process. At some time, the process finish his job, is there any way to catch the exit code? I use "echo $?" normally for commands.
Thanks! (2 Replies)
Hi All,
I was out not working on unix from quite sometime and came back recently. I would really appreciate a help on one of the issue I am facing....
I am trying to kick off the CodeNameProcess.sh in PARALLEL for all the available codes. The script runs fine in parallel.
Let say there are... (1 Reply)
Hi,
I have created a function f1 defined in script A.sh .I have called this function in background . But I want to use its return value for another function f2 in script A.sh.
I tried declaring it as a global variable, yet it always returns the status as 0. Is there any way with which I can get... (7 Replies)
Hi Team,
i am executing 3 scripts in background from 1 script and i want to send a message once the script gets completed.these scripts usually takes 1 hr to complete.
My sample script is below,
Vi abc.sh
sh /opt/data/Split_1.sh &
sh /opt/data/Split_2.sh &
sh /opt/data/Split_3.sh &
... (3 Replies)
Discussion started by: raju2016
3 Replies
LEARN ABOUT LINUX
ptree
ptree(1)ptree(1)NAME
ptree - print process trees
SYNOPSIS
/usr/bin/ptree [-a] [-c] [-z zone] [pid | user] ...
ptree prints the process trees containing the specified pids or users, with child processes indented from their respective parent pro-
cesses. An argument of all digits is taken to be a process-id, otherwise it is assumed to be a user login name. The default is all pro-
cesses.
The following options are supported:
-a All. Print all processes, including children of process 0.
-c Contracts. Print process contract memberships in addition to parent-child relationships. See process(4). This option
implies the -a option.
-z zone Zones. Print only processes in the specified zone. Each zone ID can be specified as either a zone name or a numerical zone
ID.
This option is only useful when executed in the global zone.
The following operands are supported:
pid Process-id or a list of process-ids. ptree also accepts /proc/nnn as a process-id, so the shell expansion /proc/* can be
used to specify all processes in the system.
user Username or list of usernames. Processes whose effective user IDs match those given are displayed.
Example 1: Using ptree
The following example prints the process tree (including children of process 0) for processes which match the command name ssh:
$ ptree -a `pgrep ssh`
1 /sbin/init
100909 /usr/lib/ssh/sshd
569150 /usr/lib/ssh/sshd
569157 /usr/lib/ssh/sshd
569159 -ksh
569171 bash
569173 /bin/ksh
569193 bash
The following exit values are returned:
0 Successful operation.
non-zero An error has occurred.
/proc/* process files
See attributes(5) for descriptions of the following attributes:
+-----------------------------+-----------------------------+
| ATTRIBUTE TYPE | ATTRIBUTE VALUE |
+-----------------------------+-----------------------------+
|Availability |SUNWesu |
+-----------------------------+-----------------------------+
|Interface Stability |See below. |
+-----------------------------+-----------------------------+
The human readable output is Unstable. The options are Evolving.
gcore(1), ldd(1), pargs(1), pgrep(1), pkill(1), plimit(1), pmap(1), preap(1), proc(1), ps(1), ppgsz(1), pwd(1), rlogin(1), time(1),
truss(1), wait(1), fcntl(2), fstat(2), setuid(2), dlopen(3C), signal.h(3HEAD), core(4), proc(4), process(4), attributes(5), zones(5)
11 Oct 2005 ptree(1)