10-09-2009
Rephrasing my question...
Hello,
Sorry for the inconvenience...I am rephrasing my question.
My main goal is to execute a shell script which will take "pid" as a parameter and the shell script should print the details of the "pid".
For this purpose i have created a shell script with the following content..
"ps -e |grep $1
echo $2"
When i execute the script with the parameter pid with some other parameter it does not print the pid .......
Hope it is bit clear to you....
Thanks,
Swati
10 More Discussions You Might Find Interesting
1. Shell Programming and Scripting
I have a Shell Scritp named "Statistics" which has a Infinate Wille Loop Running
I want to restart this Srcipt "Statistics" when i try to run other srcipt Ex "ABC"
so i want to kill the "Statistics" script in "ABC"
so for this I what to know the PID for that Script "Statistics" which is... (7 Replies)
Discussion started by: pbsrinivas
7 Replies
2. Shell Programming and Scripting
The script startserver.sh has permissions to execute.
Still the nohup command returns error with 'No such file or directory'
Any sugggestions:
$ nohup ./startserver.sh &
Error
$ nohup: appending output to `nohup.out'
nohup: cannot run command `./startserver.sh': No such file or... (4 Replies)
Discussion started by: hemangjani
4 Replies
3. UNIX for Dummies Questions & Answers
OS: Unix or Linux
I (only) know the pid of the process which was running earlier (say 5 hrs back) but it is not running now.
Is there a way I could find the details of that process? (atleast the name of the process). Please let me know. (2 Replies)
Discussion started by: vijay.d
2 Replies
4. Shell Programming and Scripting
Hi,
I am new this forum. I request you peoples help in understanding and finding some solution to my problem.
Here it goes:
I need to perform this set of actions by writing a shell script. I need to read a config file for the bunch of processes to execute.
I need to fecth the pid of... (4 Replies)
Discussion started by: sachin4sachi
4 Replies
5. Shell Programming and Scripting
Hi Friends,
When I try to execute one of my script script1.shl, I am getting the error message as "/tmp/sh1871978.13: cannot create" .
I could not find the specified sh* file in the /tmp directory and I also checked the disk space of /tmp and it is only 60% filled.
Please help me on... (5 Replies)
Discussion started by: mr_manii
5 Replies
6. Programming
Hello
im geting error here:
#include <stdlib.h>
#include <stdio.h>
using namespace std;
int main (int argc, char *argv)
{
char user;
string command;
cin << user;
command = printf ("grep '%s' /etc/shadow", user);
system (command.c_str());
}
return 0;
}
it should search shadow... (6 Replies)
Discussion started by: velniaszs
6 Replies
7. Shell Programming and Scripting
Guys,
I have a script that should change one of the configuration Parameter in a http accelerator, this config change which will halt http traffic into device. So I have designed a script which should do these changes. But after executing this script, found that one of the input variable is not... (8 Replies)
Discussion started by: raghunsi
8 Replies
8. Shell Programming and Scripting
Hi,
I have a shell script as below:
ORACLE_HOME=/usr/local/opt/oracle/product/dev
export ORACLE_HOME
PATH=$PATH:$ORACLE_HOME/bin:/usr/bin
export PATH
OUTFILE=/export/home/`basename $0`.out
export OUTFILE
export IDEN
df -k . | tail -1 | read a b c d e f
echo $a >> $OUTFILE
echo $b... (4 Replies)
Discussion started by: Abhinav Pandey
4 Replies
9. Shell Programming and Scripting
Hi i am getting stuck while executing the script in the below line .Please help me out
if ;then
Name=`grep -i $Size $FILE|awk '{print $(NF-1),$NF}' |head -1`
else
Name="$Nam"
fi (3 Replies)
Discussion started by: soumyamishra
3 Replies
10. UNIX for Dummies Questions & Answers
Hi All,
Just have a requirement, I am executing a bash shell script, my requirement is to catch the pid and job name to a txt file in the same directory, is there anyway to do it? please help me out.
Regards
Rahul
---------- Post updated at 08:42 AM ---------- Previous update was at... (2 Replies)
Discussion started by: rahulkalra9
2 Replies
INIT(8) System Manager's Manual INIT(8)
NAME
init - grandparent of all processes
DESCRIPTION
The first program started by Minix is init. The actions performed by init can be summarized by this pseudo shell program:
# Open 0, 1, 2.
exec </dev/null >/dev/log 2>&1
# Run the system initialization script.
sh /etc/rc $bootopts
>/etc/utmp
echo reboot >>/usr/adm/wtmp
while :; do
# Wait for a process to exit, but don't always block.
wait
# Record logout. (Not in this dumb way, of course.)
if "pid is in my tables" $pid
then
echo "logout $pid" >/etc/utmp
echo "logout $pid" >>/usr/adm/wtmp
fi
# Start a new session.
while read line type getty init
do
if idle $line
then
$init ... <$tty >$tty
$getty <$tty >$tty 2>&1 &
pid=$!
"add pid to tables" $pid
echo "login $line $pid" >/etc/utmp
echo "login $line $pid" >>/usr/adm/wtmp
fi
done < /dev/ttytab
done
The first action of init is to run /etc/rc to initialize the system as described in boot(8). Init then enters its main loop where it waits
for processes to exit, and starts processes on each enabled terminal line. The file /etc/ttytab contains a list of terminal devices, their
terminal types, the program to execute on them to allow one to login (usually getty(8)), and the program to execute first to initialize the
line (usually stty(1)). These fields may be left out to indicate that a line is disabled or that initialization is not necessary. The
commands are searched using the path /sbin:/bin:/usr/sbin:/usr/bin.
Init accepts several signals that must be sent to process id 1. (It is the first process, so natually its process id is 1.) The signals
are:
SIGHUP When receiving a hangup signal, init will forget about errors and rescan ttytab for processes to execute. Init normally rescans
ttytab each time it feels the need to respawn a process, so the hangup signal is only needed if a line has been shut down, or after
a terminate signal. Note that after turning a line off you will have to kill the process running on that line manually, init
doesn't do that for you.
SIGTERM
Normally sent by programs that halt or reboot Minix. Causes init to stop spawning new processes.
SIGABRT
Sent by the keyboard driver when the CTRL-ALT-DEL key combination is typed. Causes init to run the shutdown command. A second
abort signal makes init halt the system directly with a system call. The keyboard driver halts the system, without a sync, after
the third CTRL-ALT-DEL.
Minix vs. Minix-vmd
There are a few differences between standard Minix and Minix-vmd on how init is run. The /etc/rc file is executed under standard Minix
with input connected to /dev/console, but under Minix-vmd this is still /dev/null. This means that under Minix-vmd processes must be
reconnected to /dev/console with the intr program if they need user interaction. Minix-vmd passes the value of the bootopts boot variable
to /etc/rc. Standard Minix does not.
FILES
/etc/ttytab List of terminals devices.
/etc/utmp List of currently logged in users.
/usr/adm/wtmp Login/logout history.
SEE ALSO
ttytab(5), utmp(5), getty(8), stty(1), boot(8).
AUTHOR
Kees J. Bot (kjb@cs.vu.nl)
INIT(8)