rc.rt 1.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061
  1. #!@l_prefix@/lib/openpkg/bash @l_prefix@/etc/rc
  2. ##
  3. ## rc.rt -- Run-Commands
  4. ##
  5. %config
  6. rt_enable="$openpkg_rc_def"
  7. rt_log_files="@l_prefix@/var/rt/log/access.log"
  8. rt_log_rotsteps="10"
  9. rt_log_rotminsize="10M"
  10. rt_log_rotcomplevel="9"
  11. rt_log_rotprolog="true"
  12. rt_log_rotepilog="true"
  13. rt_err_files="@l_prefix@/var/rt/log/error.log"
  14. rt_err_rotsteps="10"
  15. rt_err_rotminsize="1M"
  16. rt_err_rotcomplevel="9"
  17. rt_err_rotprolog="true"
  18. rt_err_rotepilog="true"
  19. rt_apachectl=@l_prefix@/libexec/rt/tools/rtapachectl
  20. rt_sessiondir=@l_prefix@/var/rt/mason-session
  21. %start -u @l_rusr@
  22. rcService rt enable yes || exit 0
  23. ${rt_apachectl} start
  24. %stop -u @l_rusr@
  25. rcService rt enable yes || exit 0
  26. ${rt_apachectl} stop
  27. sleep 2
  28. %restart -u @l_rusr@
  29. rcService rt enable yes || exit 0
  30. ${rt_apachectl} stop
  31. sleep 2
  32. ${rt_apachectl} start
  33. %hourly -u @l_rusr@
  34. rcService rt enable yes || exit 0
  35. find $rt_sessiondir -type f -amin +600 -exec rm '{}' \;
  36. %daily -u @l_rusr@
  37. rcService rt enable yes || exit 0
  38. if [ ".$rt_log_files" != . ]; then
  39. shtool rotate -f \
  40. -n ${rt_log_rotsteps} -s ${rt_log_rotminsize} -d \
  41. -z ${rt_log_rotcomplevel} -o @l_musr@ -g @l_mgrp@ -m 644 \
  42. -P "$rt_log_rotprolog" \
  43. -E "${rt_apachectl} restart; $rt_log_rotepilog" \
  44. $rt_log_files
  45. fi
  46. if [ ".$rt_err_files" != . ]; then
  47. shtool rotate -f \
  48. -n ${rt_err_rotsteps} -s ${rt_err_rotminsize} -d \
  49. -z ${rt_err_rotcomplevel} -o @l_musr@ -g @l_mgrp@ -m 644 \
  50. -P "$rt_err_rotprolog" \
  51. -E "${rt_apachectl} restart; $rt_err_rotepilog" \
  52. $rt_err_files
  53. fi