Chinaunix首页 | 论坛 | 博客
  • 博客访问: 284157
  • 博文数量: 82
  • 博客积分: 2607
  • 博客等级: 少校
  • 技术积分: 785
  • 用 户 组: 普通用户
  • 注册时间: 2006-09-14 15:23
文章分类

全部博文(82)

文章存档

2012年(4)

2010年(1)

2009年(2)

2008年(8)

2007年(34)

2006年(33)

我的朋友

分类: LINUX

2007-10-25 10:43:47

#!/bin/bash
#
# chkconfig: - 55 45
# description: zabbix_server 
# probe: false
# Source function library.
. /etc/rc.d/init.d/functions
# Source networking configuration.
. /etc/sysconfig/network
# Check that networking is up. If you are running without a network, comment this out.
[ "${NETWORKING}" = "no" ] && exit 0
RETVAL=0
progdir="/usr/local/sbin/"
prog="zabbix_server"
start() {
        # Start daemons.
 if [ -n "`/sbin/pidof $prog`" ]; then
  echo -n "$prog: already running"
  failure $"$prog start"
  echo
  return 1
 fi
        echo -n $"Starting $prog: "
 # we can't seem to use daemon here - emulate its functionality
        su -c $progdir$prog - $USER
 RETVAL=$?
 usleep 100000
 if [ -z "`/sbin/pidof $progdir$prog`" ]; then
  RETVAL=1
 fi
 [ $RETVAL -ne 0 ] && failure $"$prog startup"
  [ $RETVAL -eq 0 ] && touch /var/lock/subsys/$prog && success $"$prog startup"
 echo 
 return $RETVAL
}
stop() {
 RETVAL=0
 pid=
        # Stop daemons.
        echo -n $"Stopping $prog: "
 pid=`/sbin/pidof -s $prog`
 if [ -n "$pid" ]; then
  kill -TERM $pid
        else
  failure $"$prog stop"
  echo
  return 1
        fi
 RETVAL=$?
 [ $RETVAL -ne 0 ] && failure $"$prog stop"
 [ $RETVAL -eq 0 ] && rm -f /var/lock/subsys/$prog && success $"$prog stop"
 echo
 return $RETVAL
}
restart() {
 stop
 start
# See how we were called.
case "$1" in
 start)
  start
  ;;
 stop)
  stop
  ;;
 restart)
  restart
  ;;
 condrestart)
  [ -f /var/lock/subsys/$prog ] && restart
  ;;
 *)
         echo $"Usage: $0 {start|stop|restart|condrestart}"
  exit 1
esac
exit $?
 
阅读(965) | 评论(0) | 转发(0) |
0

上一篇:javaMail

下一篇:Oracle学习笔记

给主人留下些什么吧!~~