在HP-UX系统中添加在引导时运行的程序

发表于:2007-05-26来源:作者:点击数: 标签:
由于手工禁用了snmo、nfs等服务,导致rpcbind启动时未自动运行。为使rpcbind在引导时能自动运行,今天花了1个小时,搞掂了。 1、create /sbin/init.d/rpcbind #!/sbin/sh # # @(#)B.11.11_ LR # # NOTE: This script is not configurable! Any changes made

由于手工禁用了snmo、nfs等服务,导致rpcbind启动时未自动运行。为使rpcbind在引导时能自动运行,今天花了1个小时,搞掂了。

1、create /sbin/init.d/rpcbind
#!/sbin/sh
#
# @(#)B.11.11_LR
#
# NOTE:    This script is not configurable!  Any changes made to this
#          scipt will be overwritten when you upgrade to the next
#          release of HP-UX.
#
# WARNING: Changing this script in any way may lead to a system that
#          is unbootable.  Do not modify this script.
#

#
# Start rpcbind
#
PATH=/sbin:/usr/sbin:/usr/bin
export PATH
rval=0
set_return() {
 x=$?
 if [ $x -ne 0 ]; then
  echo "ERROR CODE $x"
  rval=1
 fi
}
case in
start_msg)
 echo "Start rpcbind"
 ;;

stop_msg)
 echo "Stop rpcbind"
 ;;

'start')
 if [ -f /etc/rc.config.d/rpcbind ] ; then
  . /etc/rc.config.d/rpcbind
 else
  echo "ERROR: /etc/rc.config.d/rpcbind defaults file MISSING"
 fi
 
 if [ "$RPCBIND" -eq 1 -a -x /usr/sbin/rpcbind ]; then
  /usr/sbin/rpcbind && echo rpcbind started
  set_return
 else
  rval=2
 fi

 ;;

'stop')
 #
 # Determine PID of process(es) to stop
 #
 pid=`ps -el | awk '( ($NF ~ /rpcbind/) && ( != mypid) && ( != mypid)  ){ print }' mypid=$$ `
 if [ "X$pid" != "X" ]; then
  if kill $pid; then
   echo "rpcbind stopped"
  else
   set_return
   echo "Unable to stop rpcbind"
  fi
 fi
 ;;

*)
 echo "usage: "
 ;;
esac

exit $rval

2、chown bin:bin rpcbind

3、create /etc/rc.config.d/rpcbind
#!/sbin/sh
# @(#)B.11.11_LR       
# Cron configuration.  See cron(1m)
#
# RPCBIND:  Set to 1 to start cron daemon
#
RPCBIND=1
4、chown bin:bin rpcbind
5、create /sbin/rc3.d/S900rpcbind
内容同/sbin/init.d/rpcbind
6、chown bin:bin /sbin/rc3.d/S900rpcbind
7、create /sbin/rc2.d/K150rpcbind
内容同/sbin/init.d/rpcbind
8、chown bin:bin sbin/rc2.d/K150rpcbind
其余权限设置与同类文件相同。

原文转自:http://www.ltesting.net