startup.sh 1.0 KB

12345678910111213141516171819202122
  1. #!/bin/sh -e
  2. log-helper level eq trace && set -x
  3. ln -sf "${CONTAINER_SERVICE_DIR}/:syslog-ng-core/assets/config/syslog_ng_default" /etc/syslog-ng/syslog-ng
  4. ln -sf "${CONTAINER_SERVICE_DIR}/:syslog-ng-core/assets/config/syslog-ng.conf" /etc/syslog-ng/syslog-ng.conf
  5. # If /dev/log is either a named pipe or it was placed there accidentally,
  6. # e.g. because of the issue documented at https://github.com/phusion/baseimage-docker/pull/25,
  7. # then we remove it.
  8. if [ ! -S /dev/log ]; then rm -f /dev/log; fi
  9. if [ ! -S /var/lib/syslog-ng/syslog-ng.ctl ]; then rm -f /var/lib/syslog-ng/syslog-ng.ctl; fi
  10. # determine output mode on /dev/stdout because of the issue documented at https://github.com/phusion/baseimage-docker/issues/468
  11. if [ -p /dev/stdout ]; then
  12. sed -i 's/##SYSLOG_OUTPUT_MODE_DEV_STDOUT##/pipe/' /etc/syslog-ng/syslog-ng.conf
  13. else
  14. sed -i 's/##SYSLOG_OUTPUT_MODE_DEV_STDOUT##/file/' /etc/syslog-ng/syslog-ng.conf
  15. fi
  16. # If /var/log is writable by another user logrotate will fail
  17. /bin/chown root:root /var/log
  18. /bin/chmod 0755 /var/log