rsync启动脚本

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

 

  • 本文来自:Linux学习网


你可能感兴趣的:(function,File,local,transport,starting)