rc.apache 3.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495
  1. #!@l_prefix@/bin/openpkg rc
  2. ##
  3. ## rc.apache -- Run-Commands
  4. ##
  5. %config
  6. apache_enable="$openpkg_rc_def"
  7. apache_log_files="@l_prefix@/var/apache/log/access.log"
  8. apache_log_rotsteps="10"
  9. apache_log_rotminsize="10M"
  10. apache_log_rotcomplevel="9"
  11. apache_log_rotprolog="true"
  12. apache_log_rotepilog="true"
  13. apache_err_files="@l_prefix@/var/apache/log/error.log"
  14. apache_err_rotsteps="10"
  15. apache_err_rotminsize="1M"
  16. apache_err_rotcomplevel="9"
  17. apache_err_rotprolog="true"
  18. apache_err_rotepilog="true"
  19. apache_cgi_files="@l_prefix@/var/apache/log/script.log"
  20. apache_cgi_rotsteps="10"
  21. apache_cgi_rotminsize="1M"
  22. apache_cgi_rotcomplevel="9"
  23. apache_cgi_rotprolog="true"
  24. apache_cgi_rotepilog="true"
  25. %common
  26. apache_pidfile="@l_prefix@/var/apache/run/apache.pid"
  27. apache_signal () {
  28. [ -f $apache_pidfile ] && kill -$1 `cat $apache_pidfile`
  29. }
  30. %status -u @l_susr@ -o
  31. apache_usable="no"
  32. apache_active="no"
  33. @l_prefix@/sbin/apache -t 2>/dev/null && apache_usable="yes"
  34. rcService apache enable yes && \
  35. apache_signal 0 && apache_active="yes"
  36. echo "apache_enable=\"$apache_enable\""
  37. echo "apache_usable=\"$apache_usable\""
  38. echo "apache_active=\"$apache_active\""
  39. %start -u @l_susr@
  40. rcService apache enable yes || exit 0
  41. rcService apache active yes && exit 0
  42. ( cd @l_prefix@/var/apache/run
  43. [ -e @l_prefix@/etc/apache/apache.sh ] &&
  44. . @l_prefix@/etc/apache/apache.sh
  45. @l_prefix@/sbin/apache
  46. ) || exit $?
  47. %stop -u @l_susr@
  48. rcService apache enable yes || exit 0
  49. rcService apache active no && exit 0
  50. @l_prefix@/sbin/apache -k stop
  51. sleep 2
  52. %restart -u @l_susr@
  53. rcService apache enable yes || exit 0
  54. rcService apache active no && exit 0
  55. @l_prefix@/sbin/apache -k restart
  56. %reload -u @l_susr@
  57. rcService apache enable yes || exit 0
  58. rcService apache active no && exit 0
  59. @l_prefix@/sbin/apache -k graceful
  60. %daily -u @l_susr@
  61. rcService apache enable yes || exit 0
  62. rcTmp -i
  63. hintfile=`rcTmp -f -n hint`
  64. shtool rotate -f \
  65. -n ${apache_log_rotsteps} -s ${apache_log_rotminsize} -d \
  66. -z ${apache_log_rotcomplevel} -o @l_susr@ -g @l_mgrp@ -m 644 \
  67. -P "$apache_log_rotprolog" \
  68. -E "$apache_log_rotepilog; echo 1 >$hintfile" \
  69. ${apache_log_files}
  70. shtool rotate -f \
  71. -n ${apache_err_rotsteps} -s ${apache_err_rotminsize} -d \
  72. -z ${apache_err_rotcomplevel} -o @l_susr@ -g @l_mgrp@ -m 644 \
  73. -P "$apache_err_rotprolog" \
  74. -E "$apache_err_rotepilog; echo 1 >$hintfile" \
  75. ${apache_err_files}
  76. shtool rotate -f \
  77. -n ${apache_cgi_rotsteps} -s ${apache_cgi_rotminsize} -d \
  78. -z ${apache_cgi_rotcomplevel} -o @l_susr@ -g @l_mgrp@ -m 644 \
  79. -P "$apache_cgi_rotprolog" \
  80. -E "$apache_cgi_rotepilog; echo 1 >$hintfile" \
  81. ${apache_cgi_files}
  82. if [ -s $hintfile ]; then
  83. @l_prefix@/sbin/apache -k graceful
  84. fi
  85. rcTmp -k