#!/bin/sh
-# Copyright 2012 Quest Software, Inc. ALL RIGHTS RESERVED
-pp_revision="371"
+# Copyright 2014 Quest Software, Inc. ALL RIGHTS RESERVED
+pp_revision="20140620"
# Copyright 2012 Quest Software, Inc. ALL RIGHTS RESERVED.
#
# Redistribution and use in source and binary forms, with or without
pp_files_expand () {
typeset _p _mode _group _owner _flags _path _optional _has_target _tree
- typeset _path _file _tgt _m _o _g _f _type _lm _ll _lo _lg _ls _lx
+ typeset _target _file _tgt _m _o _g _f _type _lm _ll _lo _lg _ls _lx
typeset _ignore _a
test $# -eq 0 && return
(cd $pp_destdir && pp_verbose /usr/sbin/backup -i -q -p -f -) \
< $pp_wrkdir/bff.list \
> $pp_wrkdir/$outbff || pp_error "backup failed"
- $pp_aix_sudo /usr/sbin/installp -l -d $pp_wrkdir/$outbff
+ if test -n "$pp_aix_sudo" -o -x /usr/sbin/installp; then
+ $pp_aix_sudo /usr/sbin/installp -l -d $pp_wrkdir/$outbff
+ fi
}
pp_backend_aix_cleanup () {
fi
}
- pp_running () {
- if test ! -s "\$pidfile"; then
- return 1
- else
- read pid < "\$pidfile"
- kill -0 "\$pid" 2>/dev/null
- fi
- }
+ pp_running () {
+ if test -s "\$pidfile"; then
+ read pid < "\$pidfile" 2>/dev/null
+ if test \${pid:-0} -gt 1 && kill -0 "\$pid" 2>/dev/null; then
+ # make sure command name matches
+ c="\`echo $cmd | sed -e 's: .*::' -e 's:^.*/::'\`"
+ pid="\`ps -p \$pid 2>/dev/null | sed -n \"s/^ *\(\$pid\) .*\$c *\$/\1/p\"\`"
+ if test -n "\$pid"; then
+ return 0
+ fi
+ fi
+ fi
+ return 1
+ }
case \$1 in
start_msg) echo "Starting the \$svc service";;
# returns true if $svc is running
pp_running () {
- test -s "$pidfile" || return 1
- read pid junk < "$pidfile" 2>/dev/null
- test ${pid:-0} -gt 1 &&
- kill -0 "$pid" 2>/dev/null
+ if test -s "$pidfile"; then
+ read pid < "$pidfile" 2>/dev/null
+ if test ${pid:-0} -gt 1 && kill -0 "$pid" 2>/dev/null; then
+ # make sure command name matches up to the first 8 chars
+ c="`echo $_cmd | sed -e 's: .*::' -e 's:^.*/::' -e 's/^\(........\).*$/\1/'`"
+ pid="`ps -p $pid 2>/dev/null | sed -n \"s/^ *\($pid\) .*$c *$/\1/p\"`"
+ if test -n "$pid"; then
+ return 0
+ fi
+ fi
+ fi
+ return 1
}
# prints a message describing $svc's running state
file=${pp_solaris_service_script:-"/etc/init.d/${pp_solaris_service_script_name:-$svc}"}
echo '
-'$file' stop >/dev/null 2>/dev/null
if [ "x${PKG_INSTALL_ROOT}" = 'x' ]; then
if [ -x /usr/sbin/svcadm ] ; then
- # Likely un-needed, but just in case.
/usr/sbin/svcadm disable -s '$svc' 2>/dev/null
/usr/sbin/svccfg delete '$svc' 2>/dev/null
+ else
+ '$file' stop >/dev/null 2>/dev/null
fi
fi
'
# Generated by PolyPackage ${pp_version}
# ${copyright}
+ prog="`echo $cmd | sed -e 's: .*::' -e 's:^.*/::'`"
+
.
if test x"${svc_description}" = x"${pp_rpm_default_svc_description}"; then
#-- delivers signal $1 to the pidfile
# returns 0=success 1=failure
pp_signal () {
- if test -r "$pidfile"; then
- read pid < $pidfile
+ if test -s "$pidfile"; then
+ read pid < "$pidfile" 2>/dev/null
kill "$@" "$pid" 2>/dev/null
else
return 1
fi
}
+ #-- verifies that ${svc_name} is running
+ # returns 0=success 1=failure
+ pp_running () {
+ if test -s "$pidfile"; then
+ read pid < "$pidfile" 2>/dev/null
+ if test ${pid:-0} -gt 1 && kill -0 "$pid" 2>/dev/null; then
+ # make sure name matches
+ pid="`ps -p $pid 2>/dev/null | sed -n \"s/^ *\($pid\) .*$prog *$/\1/p\"`"
+ if test -n "$pid"; then
+ return 0
+ fi
+ fi
+ fi
+ return 1
+ }
+
#-- prints information about the service status
# returns 0=running 1=crashed 3=stopped
pp_status () {
pp_msg "Checking for ${svc_name}"
- if pp_signal -0; then
+ if pp_running; then
pp_success_msg "running"
return 0
- elif test -r "$pidfile"; then
+ elif test -s "$pidfile"; then
pp_failure_msg "not running (crashed)"
return 1
else