rsync startup script
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.
21st
[-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 "$" 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: $ {Start|stop|restart|reload|status}"
62
Exit 2
63
Esac
64
65
Exit $RETVAL
- This article is from: Linux Learning Network
rsync startup script