* Stephen Hahn <sch at eng.sun.com> [2006-06-09 11:06]: > * Kedar Mhaswade <Kedar.Mhaswade at Sun.COM> [2006-06-09 10:41]: Okay, now that I've read the rest of this thread, I see that your current command has a non-zero exit if it thinks the processes are already stopped. Plus, we can easily improve and correct my first outline.
> Your method probably needs to be augmented like CTID=$(/usr/bin/svcprop -p restarter/contract $SMF_FMRI) > current_stop_command > if [ $? = $COMMAND_ALREADY_STOPPED_CODE ]; then echo "Already stopped." elsif [ $? != 0 ]; then echo "Stop failed. Manual cleanup." > # partial failures require blanket cleanup > > # process cleanup > pkill -TERM -c $CTID pkill -KILL -c $CTID > > # any file or other persistent namespace cleanup > ... > fi > # Test that contract has emptied. if /usr/bin/pgrep -c $CTID > /dev/null; then echo "Contract $CTID not empty; stop failed." exit $SMF_EXIT_ERR_FATAL fi > exit 0 - Stephen -- Stephen Hahn, PhD Solaris Kernel Development, Sun Microsystems stephen.hahn at sun.com http://blogs.sun.com/sch/