Running from Shell Vs running from RC script


 
Thread Tools Search this Thread
Operating Systems Solaris Running from Shell Vs running from RC script
# 1  
Old 07-31-2008
Question Running from Shell Vs running from RC script

Hi,
i have a script which need to do behave differently when run as a startup process from init.d/ rc2.d script and when run manually from shell.
How do i distinguish whether my script is run by init process or by shell??

Will the command
/proc/$$/psinfo | grep "myscript" work well???
Problem is i can't reboot my system to verify it.
# 2  
Old 07-31-2008
# 3  
Old 07-31-2008
apptrace - for trace of library calls
dtrace - debugger, new in version 10
pargs - get list of arguments and environment variables with which process was started
pfiles - list of file descriptors, associated with process
pgrep - get the PID's of processes by name i.e. Something like ps -efl|grep -v grep|grep process_name
pkill - send signal to process. For example pkill -9 init :-P
pldd - list dynamic libraries, associated with process, similar to ldd for executable
plockstat - see list of locked by process files. Lock can be mutex i.e. exclusive and reader/writer for shared access
pmap - get memory map (segments) of process
preap - try to kick-off zombie process
prstat - fullscreen view of processes sorted by different criteria, similar to Linux top command
prun - continue hold with pstop process
ps - print process information and status. In Solaris exist SYSV and BSD variants, respectively /usr/bin/ps and /usr/ucb/ps
psig - list signals that can be handled by process
pstack - get backtrace stack of process for debugging purposes
pstop - temporary hold process
ptree - print the tree of processes
pwait - wait till process finish
pwdx - list working directory for process, like pwd command
truss - for trace system calls and signals
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 is not running

Hi, when iam running below command it is executing fine on my linux command prompt. java -jar Efile.jar but the same command iam using in Shell script it doesnt work and saying error Unable to access jar files. Flavour is Linux Redhat. pls help (1 Reply)
Discussion started by: Riverstone
1 Replies

2. Shell Programming and Scripting

Running C++ like shell script

i found the following code off the web. its suppose to read large log files, efficiently. but i dont have an idea of how to run it. i know its C and you need to "compile". how do i compile it? and is it really necessary to compile? /* ** File FILE_3.C ** ** Illustrates how to read from a... (2 Replies)
Discussion started by: SkySmart
2 Replies

3. UNIX for Dummies Questions & Answers

Shell Script Not Running

Hi , I Am Getting The Following Error When Executing Shell Script E32 :No File This Are Steps I Have Done For Running The . 1) VI Command So It Opened Vi Editor 2) VI FILENAME.KSH In The File I Have Written A Program Like Below #!/bin/ksh echo date 3):WQ For Quit And Save.... (5 Replies)
Discussion started by: anudeepkumar123
5 Replies

4. Shell Programming and Scripting

running a script in korn shell

I'm learning bash and have discovered that the shell can only work with integers and not decimals. I'd like to run my scripts in korn to account for this, but just now, when I tried to run my script, I got an error message that said 'no such file or directory,' even though when I'm in the shell... (3 Replies)
Discussion started by: Straitsfan
3 Replies

5. Shell Programming and Scripting

How to tell which shell is running a script

I've been searching for a while and haven't found this answer anywhere. How can I tell which shell is running my script from within the script? For example, I have lots of older scripts that we are porting to a new Linux system. Many of the scripts start with ":" alone on a line, which I think... (12 Replies)
Discussion started by: sbaker
12 Replies

6. Shell Programming and Scripting

running a shell script

sometimes while running a shell script we use ksh -c '....script' what is the significance of ksh -c here .... what if i run the script only.what is the difference (6 Replies)
Discussion started by: dr46014
6 Replies

7. Shell Programming and Scripting

running a shell script from another

hi, I have 2 k-shell script a1.sh and T1.sh. I m running T1.sh from a1.sh and passing variable "i" to T1.sh.But i m getting error output. a1.sh ----------------------------------------------------- #!/bin/ksh cd /ednadtu3/u01/pipe/logs for i in Cleaner2 Cleaner1 do count=0... (1 Reply)
Discussion started by: ali560045
1 Replies

8. UNIX for Advanced & Expert Users

shell script not running

Dear Friends, OS: REDHAT ENTERPRISE LINUX ,nash version I am facing a peculier type of problem.A bash script ran yesterday does not run successfully today . Absolutely giving NO OUTPUT AT ALL. We have migrated recently from redhat linux 9 to REDHAT ENTERPRISE LINUX 4.4 recently .What... (3 Replies)
Discussion started by: vakharia Mahesh
3 Replies

9. Shell Programming and Scripting

Running Shell Script from Java

Hi How can I call a .sh (shell script) from a java procedure? Is this possible at all? Please tell me. Thanks. Asty (3 Replies)
Discussion started by: Asty
3 Replies

10. Shell Programming and Scripting

Korn Shell script not running

I am sorry, this is really trivial, yet I am not able to understand what the problem is! I am using korn shell and running this script #!/bin/ksh keep=3 while ; do echo $keep keep=$(($keep-1)) done I am getting this error: `keep=$' unexpected I am not able to understand it because ... (1 Reply)
Discussion started by: Asty
1 Replies
Login or Register to Ask a Question