码迷,mamicode.com
首页 > 其他好文 > 详细

rsync启动脚本

时间:2015-01-15 12:18:09      阅读:178      评论:0      收藏:0      [点我收藏+]

标签:

rsync启动脚本

01

#!/bin/bash  www.ahlinux.com  

02

#

03

# rsyncd      This shell script takes care of starting and stopping

04

#             standalone rsync.

05

#

06

# chkconfig: - 99 50

07

# description: rsync is a file transport daemon

08

# processname: rsync

09

# config: /etc/rsyncd.conf

10

  

11

# Source function library

12

. /etc/rc.d/init.d/functions

13

  

14

RETVAL=0

15

rsync="/usr/local/bin/rsync"

16

prog="rsync"

17

CFILE="/etc/rsyncd.conf"

18

19

start() {

20

        # Start daemons.

21

        [ -x $rsync ] || \

22

            { echo "FATAL: No such programme";exit 4; }

23

        [ -f $CFILE ] || \

24

            { echo "FATAL: config file does not exist";exit 6; }

25

        echo -n $"Starting $prog: "

26

        daemon $rsync --daemon --config=$CFILE

27

        RETVAL=$?

28

        [ $RETVAL -eq 0 ] && touch /var/lock/subsys/$prog

29

        echo

30

        return $RETVAL

31

}

32

  

33

stop() {

34

        # Stop daemons.

35

        echo -n $"Stopping $prog: "

36

        killproc $prog -QUIT

37

        RETVAL=$?

38

        echo

39

        [ $RETVAL -eq 0 ] && rm -f /var/lock/subsys/$prog

40

        return $RETVAL

41

}

42

  

43

# call the function we defined

44

case "$1" in

45

  start)

46

        start

47

        ;;

48

  stop)

49

        stop

50

        ;;

51

  restart|reload)

52

        stop

53

        start

54

        RETVAL=$?

55

        ;;

56

  status)

57

        status $prog

58

        RETVAL=$?

59

        ;;

60

  *)

61

        echo $"Usage: $0 {start|stop|restart|reload|status}"

62

        exit 2

63

esac

64

  

65

exit $RETVAL

 

rsync启动脚本

标签:

原文地址:http://www.cnblogs.com/bokejiayuan/p/4225667.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!