rc.local 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  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 ] || ( mkdir $_SG/logs
  23. chown httpd $_SG/logs
  24. )
  25. ## check for tmp directory
  26. [ -e $_SG/tmp ] || ( mkdir $_SG/tmp
  27. chown httpd $_SG/tmp
  28. )
  29. ## check symlinking
  30. # for i in devTools resources templates; do
  31. # [ -L $_SG/$i ] || ln -s /www/lib/$i $_SG/$i
  32. # done
  33. ## if /www/tmp does not exist
  34. # [ -d $_SG/tmp ] || (
  35. # mkdir $_SG/tmp && chown httpd $_SG/tmp
  36. # )
  37. ## needed to make lighty use mounted location for logs
  38. /etc/init.d/lighttpd restart
  39. )&
  40. exit 0