How to get the status of the method


 
Thread Tools Search this Thread
Operating Systems Solaris How to get the status of the method
# 1  
Old 04-06-2009
How to get the status of the method

Hi,

I have created a services and method to start the processes.

Method:

#!/sbin/sh

. /lib/svc/share/smf_include.sh

case "$1" in
'start')
/usr/local/proce start
sleep 10
;;
'stop')
/usr/local/proce stop
;;
*)
echo "Usage: $0 { start | stop }"
exit 1
;;
esac

exit $SMF_EXIT_OK

Here am exit with SMF_EXIT_OK.
How can I get the status of start and stop whether it is successful or failure.
In the place of SMF_EXIT_OK I need to return the status of start and stop.

Please help me in solving this.
When i check in smf-include.sh , i got the following exit level
SMF_EXIT_OK=0
SMF_EXIT_ERR_FATAL=95
SMF_EXIT_ERR_CONFIG=96
SMF_EXIT_MON_DEGRADE=97
SMF_EXIT_MON_OFFLINE=98
SMF_EXIT_ERR_NOSMF=99
SMF_EXIT_ERR_PERM=100


Regards,
Kalai
# 2  
Old 04-06-2009
Try:
Code:
/usr/local/proce start        
STATUS=$?

and

Code:
/usr/local/proce stop
STATUS=$?

and then at the end of the script:
Code:
echo STATUS = ${STATUS}
exit ${STATUS}

The variables you quote would need to be used in /usr/local/proce to set its exit code if you wanted to use them.
# 3  
Old 04-07-2009
Thanks a lot Smilie

I need one for info.
The services state is online ,when I stop the processes through the method manually.
How can i change the state to offline once the process are killed.
# 4  
Old 04-07-2009
You stop the service by running:
Code:
# svcadm disable <service>

You should not directly kill off the processes first let, SMF do it.

If you only want to stop the service temporarily (i.e. you want the service to restart when the machine is rebooted) then put a "-t" in before "disable".
# 5  
Old 04-08-2009
Thanks a lot Smilie

Using shell script how can i get the status of the services
# 6  
Old 04-08-2009
Quote:
Originally Posted by TonyFullerMalv
You stop the service by running:
Code:
# svcadm disable <service>

You should not directly kill off the processes first let, SMF do it.

If you only want to stop the service temporarily (i.e. you want the service to restart when the machine is rebooted) then put a "-t" in before "disable".
it is changin the state to disable , but i need the service state to offline.
How can i get the state as offline Smilie
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. UNIX for Beginners Questions & Answers

How to see the status of all the ftp put & get files logs and curent ftp transfer status ?

How to see the status of all the ftp put & get files logs and curent ftp transfer status if any active ftp running in the background ? (2 Replies)
Discussion started by: i4ismail
2 Replies

2. Programming

How to track table status delete/update/insert status in DB2 V10 z/os?

Dear Team I am using DB2 v10 z/os database . Need expert guidance to figure out best way to track table activities ( Ex Delete, Insert,Update ) Scenario We have a table which is critical and many developer/testing team access on daily basis . We had instance where some deleted... (1 Reply)
Discussion started by: Perlbaby
1 Replies

3. Shell Programming and Scripting

Another method for this snippet

Hi All, i believe this is not very efficient. another method would be appreciated for these. basically i read a file with tab delimited column and pass the column to another perl script. while read line do timestamp=`echo "$line"|awk -F"\t" '{print $1}'` severity=`echo... (15 Replies)
Discussion started by: ryandegreat25
15 Replies

4. Solaris

svc:/network/physical:default: Method "/lib/svc/method/net-physical" failed with exit status 96. [ n

After a memory upgrade all network interfaces are misconfigued. How do i resolve this issue. Below are some out puts.thanks. ifconfig: plumb: SIOCLIFADDIF: eg000g0:2: no such interface # ifconfig eg1000g0:2 plumb ifconfig: plumb: SIOCLIFADDIF: eg1000g0:2: no such interface # ifconfig... (2 Replies)
Discussion started by: andersonedouard
2 Replies

5. Programming

message and method

Differentiate between the message and method. (2 Replies)
Discussion started by: robinglow
2 Replies

6. Shell Programming and Scripting

Help in replace method

Hi Gurus, VARIABLE=john_*_has_*_s i want to replace the * with digits 09100 and 0010101 to print the john_09100_has_0010101_s Thanks (3 Replies)
Discussion started by: SeenuGuddu
3 Replies

7. UNIX for Dummies Questions & Answers

Optimized Method

Hi All, I have got two files. File A with 50000 records and File B with some 500 million records. I need to extract the mapping data (common data) from both the files. There should be definitely many ways :) though I have a way which is definitely not optimzed and takes a longer time... (2 Replies)
Discussion started by: matrixmadhan
2 Replies

8. Red Hat

Installing RedHat 8.0 onto Dell PowerEdge SC1425 - hdc: status error: status = 0x58

I have successfully installed RedHat 8.0 onto a Dell PowerEdge SC1425 today. This server has two SATA hard drives, and an IDE DVD-ROM drive. Using the following kernel parameters, i successfully installed across both hard drives from CD: ide0=0x1f0,0x3f6,14 vga=791 resolution=1024x768 expert... (5 Replies)
Discussion started by: fishsponge
5 Replies

9. Shell Programming and Scripting

check the status and send an email with status

Hi, We have a text file which has the following data. ISA~00~ ~00~ ~ZZ~VISTN ~ZZ~U1CAD ~051227~183 7~U~00200~000011258~0~P~< GS~FA~EE05J~U1CAD~051227~1831~000011258~X~002002 ST~997~0001 AK1~SH~247 AK2~856~2470001 AK5~A AK2~856~2470002 AK5~A... (3 Replies)
Discussion started by: isingh786
3 Replies

10. UNIX for Dummies Questions & Answers

Couldn't open status file /var/samba/STATUS.LCK

I believe i have most of samba configured right but i get this error each time time try to run it. I was given suggestion that i touch the file, i did, but i still cannot rid myself of this error. Any suggestions (2 Replies)
Discussion started by: macdonto
2 Replies
Login or Register to Ask a Question