Rsync STARTUP script 01 #! /Bin/bash www.2cto.com 02 #03 # rsyncd This shell script takes care of starting and stopping04 # standalone rsync.05 #06 # chkconfig:-99 5007 # description: rsync is a file transport daemon08 # processname: rsync09 # config:/etc/rsyncd. conf10 11 # Source function library12./etc/rc. d/init. d/functions13 14 RETVAL = 015 rsync = "/usr/local/bin/rsync" 16 prog = "rsync" 17 CFILE = "/etc/rsyncd. conf "18 19 start () {20 # Star T 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 = $ CFILE27 RETVAL =$? 28 [$ RETVAL-eq 0] & touch/var/lock/subsys/$ prog29 echo30 return $ RETVAL31} 32 33 stop () {34 # Stop daemons.35 echo-n $ "Stopping $ prog:" 36 killproc $ prog-QUIT37 RETVAL =$? 38 echo39 [$ RETVAL-eq 0] & rm-f/var/lock/subsys/$ prog40 return $ RETVAL41} 42 43 # call the function we defined44case "$1" in45 start) 46 start47; 48 stop) 49 stop50; 51 restart | reload) 52 stop53 start54 RETVAL =$? 55; 56 status) 57 status $ prog58 RETVAL =$? 59; 60 *) 61 echo $ "Usage: $0 {start | stop | restart | reload | status}" 62 exit 263esac64 65 exit $ RETVAL