rc.rsync 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465
  1. #!@l_prefix@/lib/openpkg/bash @l_prefix@/etc/rc
  2. ##
  3. ## rc.rsync -- OpenPKG run-commands
  4. ##
  5. %config
  6. rsync_enable="yes"
  7. rsync_flags=""
  8. rsync_log_numfiles="5"
  9. rsync_log_minsize="512K"
  10. rsync_log_complevel="9"
  11. %common
  12. rsync_cfgfile="@l_prefix@/etc/rsync/rsync.conf"
  13. rsync_logfile="@l_prefix@/var/rsync/rsync.log"
  14. rsync_pidfile="@l_prefix@/var/rsync/rsync.pid"
  15. %start -p 200 -u root
  16. if opServiceEnabled rsync; then
  17. @l_prefix@/bin/rsync $rsync_flags \
  18. --daemon --config=$rsync_cfgfile
  19. fi
  20. %stop -p 200 -u root
  21. if opServiceEnabled rsync; then
  22. if [ -f $rsync_pidfile ]; then
  23. kill -TERM `cat $rsync_pidfile`
  24. fi
  25. fi
  26. %restart -u root
  27. if opServiceEnabled rsync; then
  28. if [ -f $rsync_pidfile ]; then
  29. kill -TERM `cat $rsync_pidfile`
  30. sleep 2
  31. fi
  32. @l_prefix@/bin/rsync $rsync_flags \
  33. --daemon --config=$rsync_cfgfile
  34. fi
  35. %reload -u root
  36. if opServiceEnabled rsync; then
  37. if [ -f $rsync_pidfile ]; then
  38. kill -HUP `cat $rsync_pidfile`
  39. fi
  40. fi
  41. %daily -u root
  42. if opServiceEnabled rsync; then
  43. shtool rotate -f \
  44. -n ${rsync_log_numfiles} -s ${rsync_log_minsize} \
  45. -d -z ${rsync_log_complevel} -o @l_musr@ -g @l_mgrp@ -m 644 \
  46. -E "kill -HUP `cat $rsync_pidfile`" \
  47. $rsync_logfile
  48. fi
  49. %env
  50. if opServiceEnabled rsync; then
  51. if [ -f "@l_prefix@/bin/ssh" ]; then
  52. RSYNC_RSH="@l_prefix@/bin/ssh"
  53. export RSYNC_RSH
  54. fi
  55. fi