Advertisement
Astralix

apache and tmpfs

Feb 16th, 2015
188
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.15 KB | None | 0 0
  1. :/etc/init.d$ cat apache2-tmpfs
  2.  
  3.  
  4. #!/bin/bash
  5. #
  6. ### BEGIN INIT INFO
  7. # Provides: apache2-tmpfs
  8. # Default-Start: 2 3 4 5
  9. # Default-Stop: 0 1 6
  10. # Required-Start:
  11. # Required-Stop:
  12. # Short-Description: Create /var/log/apache2/error.log on tmpfs at startup
  13. # Description: Create /var/log/apache2/error.log needed by Apache.
  14. ### END INIT INFO
  15.  
  16. #
  17. # main()
  18. #
  19. case "${1:-''}" in
  20. 'start')
  21. # create the /var/log/apache2/error.log needed by apache
  22. mkdir /var/log/apache2
  23. chmod 755 /var/log/apache2
  24. chown root:adm /var/log/apache2
  25. # copy back existing logs
  26. cp /permanent/apache2/var/log/error.log /var/log/apache2/
  27. cp /permanent/apache2/var/log/access.log /var/log/apache2/
  28. #chmod 644 /var/log/apache2/error.log
  29. #chown root:adm /var/log/apache2/error.log
  30. ;;
  31. 'stop')
  32. # Backup existing logs including all logrotates
  33. mkdir -p /permanent/apache2/var/log
  34. cp /var/log/apache2/* /permanent/apache2/var/log/
  35. ;;
  36. 'restart')
  37. ;;
  38. 'reload'|'force-reload')
  39. $0 stop
  40. $0 start
  41. ;;
  42. 'status')
  43. ;;
  44. *)
  45. echo "Usage: $SELF start"
  46. exit 1
  47. ;;
  48. esac
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement