Computing.Net > Forums > Solaris > svc:/network/bbclient maintaionance

Computer Problems? Computing.Net has over 1,000,000 posts about all things technology related! Over 90% answered within 24 hours! Click here to start participating now! Also, be sure to check out the New User Guide.

svc:/network/bbclient maintaionance

Reply to Message Icon

Name: pankajd
Date: September 23, 2008 at 09:07:05 Pacific
OS: solaris 10
CPU/Ram: amd-512
Product: intel
Comment:

hi,
i am using solaris 10. and i want to add bbclient init script in it.it uses smf.but i get error svc:/network/bbclient:default to maintaionance bcoz it complets dependency cycle.i cant undesrstand wt to do...svcs -xv also shows the same thing and kept service in maintainance mode..wt to do to overcome this?
/lib/svc/method/bbclient
# !/bin/bash

# ident "@(#)bbclient 1.1 08/09/01 SMI"
#description: init script for bbclient service

# bbclient startup script:-
# Init/rc scripts are bash scripts used to manage services like bbclient.
# Init script for bbclient provides features for starting , stopping , getting status
# and restarting bbclient service.

prog="bbclient"

finger bbclient 1>/dev/null 2>/tmp/fingererr

if test -s /tmp/fingererr;then
echo "User bbclient does not exist.exiting.."
rm -f /tmp/fingererr
exit 1

fi

BB_USER_HOME=`finger bbclient|grep ^Directory|awk '{print $2}'`

BBHOME=${BB_USER_HOME}/bbc1.9i-btf

#echo "bbhome is $BBHOME"
#variable declaration

#BBHOME="/home/bbclient/bbc1.9i-btf"

PATH_TO_bbclient=${BBHOME}/runbb.sh

BBHOSTS_FILE=${BBHOME}/etc/bb-hosts

BBDEF_FILE=${BBHOME}/etc/bbdef-client.sh

LOCALTEST_FILE=${BBHOME}/bin/bb-local.sh

PID_FILE=${BBHOME}/tmp/BBPID

# Source function library.
#. /etc/rc.d/init.d/functions

if [ "$BBHOME" = "" -o ! -d "$BBHOME" ];then
echo "BBHOME IS INVALID"
echo "Please check runbb.sh for BBHOME !"
exit 1
fi

if [ ! -f "$BBHOSTS_FILE" ];then
echo "Can't start BB as the etc/bb-hosts file is missing"
echo "If this is a BB client, you should copy the etc/bb-hosts file"
echo " from your BBDISPLAY server"
exit 1
fi

if [ ! -f "$BBDEF_FILE" ];then
echo "$BBDEF_FILE file not found,please load the file"
exit 1
fi

if [ ! -f "$LOCALTEST_FILE" ];then
echo "$LOCALTEST_FILE file not found,please load the file"
exit 1
fi

#check for bbclient service file
if [ ! -x "$PATH_TO_bbclient" ];then
echo "$0:file $PATH_TO_bbclient not found"

exit 1

fi

#TEST FUNCTION
testfn() {

STR=`ps -aef | grep bbclient | grep bbrun |grep -v grep`
if [ -f "$PID_FILE" -a -n "$STR" ];then
return 2
else
return 3
fi

}

#START function
start() {
testfn
if [ $? -eq 2 ]; then
echo -e "Error:bbclient is already running"
exit 0

else

#starting bbclient service
su - bbclient -c "${PATH_TO_bbclient} start"
sleep 1
fi

#printing status as "ok" in green colour
testfn

if [ $? -eq 2 ];then

echo -en "bbrun: [ \033[32mOK "

tput sgr0

echo " ]"


else
#printing status as "failed" in red colour

echo -en "bbrun: [ \033[31mFAILED "

tput sgr0

echo " ]"

fi

}

#option for stopping bbclient
stop() {
testfn
if [ $? -eq 2 ];then

echo "stopping bbclient service"

su - bbclient -c "${PATH_TO_bbclient} stop >/dev/null 2>&1"
su - bbclient -c "ps -aef|grep bbrun |grep -v grep|cut -d' ' -f2|xargs kill -9 >/dev/null 2>&1"
testfn
if [ $? -eq 3 ];then
echo "bbclient service is stopped"
else
echo "bbclient service can not be stopped"
fi

else

echo -e "bbclient service is not running hence can not be stopped"

fi

}

#option for knowing status
status() {
testfn
if [ $? -eq 2 ];then
echo -e "STATUS : bbclient is running"

echo -en 'Pid of bbclient : '
cat $PID_FILE
else

echo -e "STATUS : bbclient is not running"

fi

exit 0
}

#Handling arguments
case "$1" in

start)#call to start function

start
;;

stop)#call to stopall function

stop
;;

restart)#first call to start function and then to stop function

echo "restarting bbclient"

stop
start
testfn

if [ $? -eq 2 ];then
echo "bbclient is restarted"
else
echo "bbclient is not restarted"
fi

;;

status)#call to status function

status
;;

*)#invalid arguments passed will see this

echo -e "\nUsage: $0 {start|stop|status|restart}"

echo -e "\n1)start - Start bbclient service if it is not running"

echo "2)stop - stop the bbclient service"

echo "3)status - current status and information of bbclient service"

echo "4)restart - stop bbclient and then start again"

if [ -z "$1" ];then

echo -e "\nno argument passed"
exit 1

elif [ $# -gt 1 ];then

echo -e "\nenter only one argument"
exit 1

else

echo -e "\nenter argument properly"
exit 1
fi
;;
esac
my manifest file is
/var/svc/manifest/network

<?xml version='1.0'?>
<!DOCTYPE service_bundle SYSTEM '/usr/share/lib/xml/dtd/service_bundle.dtd.1'>
<!--
Copyright 2004 Sun Microsystems, Inc. All rights reserved.
Use is subject to license terms.

ident "@(#)bbclient.xml 1.4 17/09/08 SMI"

NOTE: This service description is not editable; its contents
may be overwritten by package or patch operations, including
operating system upgrade. Make customizations in a different
file.
-->

<service_bundle type='manifest' name='SUNWbbcr:bbclient'>

<service
name='network/bbclient'
type='service'
version='1'>

<create_default_instance enabled='false' />

<restarter>
<service_fmri value='svc:/network/bbclient:default' />
</restarter>

<exec_method
type='method'
name='start'
exec='/lib/svc/method/bbclient %m'
timeout_seconds='30'>
</exec_method>

<exec_method
type='method'
name='stop'
exec='/lib/svc/method/bbclient %m'
timeout_seconds='30'>
</exec_method>

<exec_method
type='method'
name='restart'
exec='/lib/svc/method/bbclient %m'
timeout_seconds='30'>
</exec_method>


<exec_method
type='method'
name='status'
exec='/lib/svc/method/bbclient %m'
timeout_seconds='30'>
</exec_method>

<template>
<common_name>
<loctext xml:lang='C'>
bbclient
</loctext>
</common_name>
</template>

</service>

</service_bundle>
wt is wrong?please help..............




Sponsored Link
Ads by Google
Reply to Message Icon

Related Posts

See More






Use following form to reply to current message:

Login or Register to Reply
LoginRegister


Sponsored links

Ads by Google


Results for: svc:/network/bbclient maintaionance

ftp: connect: Connection timed out www.computing.net/answers/solaris/ftp-connect-connection-timed-out/4993.html

query regarding Sendmail service www.computing.net/answers/solaris/query-regarding-sendmail-service/5041.html

Sun0s 5.7 networking www.computing.net/answers/solaris/sun0s-57-networking/2810.html