rc.local 980 B

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. #!/bin/bash
  2. ## tweaks
  3. sysctl -w vm.swappiness=10
  4. ## some checks specific to Superglue
  5. ## where Superglue storage is mounted
  6. _SG=/mnt/sg
  7. ## htdocs to bind to
  8. _HTDOCS=/www/htdocs
  9. ## mount if needed
  10. while ! mountpoint -q $_HTDOCS; do [ $n -gt 30 ] && break;
  11. mount --bind $_SG/htdocs $_HTDOCS;
  12. let n++
  13. done
  14. unset n
  15. mountpoint -q $_HTDOCS || ( echo 'failed to mount HTDOCS..'; exit 1; )
  16. ## if /www/htdocs is mounted, then..
  17. ## if not writable chown with httpd
  18. [ $(stat $_HTDOCS -c %U) != 'httpd' ] && chown -R httpd $_HTDOCS
  19. [ $(stat $_HTDOCS -c %a) -lt '755' ] && chmod -R u+rwX $_HTDOCS
  20. ## check if index.html is present
  21. [ -e $_HTDOCS/index.html ] || (
  22. cp /www/lib/resources/demo.html $_HTDOCS/default.html
  23. chown httpd $_HTDOCS/default.html
  24. )
  25. ## check for log directory
  26. [ -e /www/log ] || ( mkdir /www/log
  27. chown httpd /www/log
  28. /etc/init.d/lighttpd reload
  29. )
  30. ## check for tmp directory
  31. [ -e /www/tmp ] || ( mkdir /www/tmp
  32. chown httpd /www/tmp
  33. )
  34. exit 0