rc.local 1.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  1. #!/bin/bash
  2. ## tweaks
  3. sysctl -w vm.swappiness=10
  4. ## checks specific to Superglue
  5. ## where Superglue storage is mounted
  6. _SG=/www/htdocs
  7. ## mount if needed
  8. #mountpoint -q $_SG || block mount $_SG
  9. #mountpoint -q $_SG || mount -L sg-user -o rw,noatime,nodiratime $_SG
  10. ## this seems to be the only way to mount btrfs on boot, ups ## (sleep 15; mount /dev/sda3 -o rw,noatime,nodiratime $_SG
  11. ## if /www/htdocs is mounted
  12. mountpoint -q $_SG && (
  13. ## if not writable chown with httpd
  14. [ $(stat $_SG -c %U) != 'httpd' ] && chown -R httpd $_SG
  15. [ $(stat $_SG -c %a) -lt '755' ] && chmod -R u+rwX $_SG
  16. ## check if index.html is present
  17. [ -e $_SG/index.html ] || (
  18. cp /www/lib/resources/index.html $_SG/default.html
  19. chown httpd $_SG/default.html
  20. )
  21. ## check for log directory
  22. [ -e $_SG/logs ] || (
  23. mkdir $_SG/logs
  24. chown httpd $_SG/logs
  25. /etc/init.d/lighttpd reload
  26. )
  27. ## check for tmp directory
  28. [ -e $_SG/tmp ] || (
  29. mkdir $_SG/tmp
  30. chown httpd $_SG/tmp
  31. )
  32. ## check for favicon
  33. [ -e $_SG/favicon.ico ] || (
  34. cp /www/lib/resources/img/favicon.ico $_SG/favicon.ico
  35. chown httpd $_SG/favicon.ico
  36. )
  37. )
  38. exit 0