rsyslog.init 1.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283
  1. #!/bin/bash
  2. #
  3. # rsyslog Starts rsyslogd/rklogd.
  4. #
  5. #
  6. # chkconfig: 2345 12 88
  7. # description: Syslog is the facility by which many daemons use to log \
  8. # messages to various system log files. It is a good idea to always \
  9. # run rsyslog.
  10. ### BEGIN INIT INFO
  11. # Provides: $syslog
  12. # Required-Start: $local_fs
  13. # Required-Stop: $local_fs
  14. # Default-Start: 2 3 4 5
  15. # Default-Stop: 0 1 6
  16. # Short-Description: Enhanced system logging and kernel message trapping daemons
  17. # Description: Rsyslog is an enhanced multi-threaded syslogd supporting,
  18. # among others, MySQL, syslog/tcp, RFC 3195, permitted
  19. # sender lists, filtering on any message part, and fine
  20. # grain output format control.
  21. ### END INIT INFO
  22. # Source function library.
  23. . /etc/init.d/functions
  24. RETVAL=0
  25. PIDFILE=/var/run/syslogd.pid
  26. prog=rsyslogd
  27. exec=/sbin/rsyslogd
  28. lockfile=/var/lock/subsys/$prog
  29. reload() {
  30. RETVAL=1
  31. syslog=$(cat "${PIDFILE}" 2>/dev/null)
  32. echo -n "Reloading system logger..."
  33. if [ -n "${syslog}" ] && [ -e /proc/"${syslog}" ]; then
  34. kill -HUP "$syslog";
  35. RETVAL=$?
  36. fi
  37. if [ $RETVAL -ne 0 ]; then
  38. failure
  39. else
  40. success
  41. fi
  42. echo
  43. return $RETVAL
  44. }
  45. rhstatus() {
  46. status -p "${PIDFILE}" $prog
  47. }
  48. restart() {
  49. stop
  50. start
  51. }
  52. case "$1" in
  53. start)
  54. start
  55. ;;
  56. stop)
  57. stop
  58. ;;
  59. restart)
  60. restart
  61. ;;
  62. reload|force-reload)
  63. reload
  64. ;;
  65. status)
  66. rhstatus
  67. ;;
  68. condrestart|try-restart)
  69. rhstatus >/dev/null 2>&1 || exit 0
  70. restart
  71. ;;
  72. *)
  73. echo $"Usage: $0 {start|stop|restart|condrestart|try-restart|reload|force-reload|status}"
  74. exit 3
  75. esac
  76. exit $?