#!/bin/bash ## tweaks sysctl -w vm.swappiness=10 ## some checks specific to Superglue ## where Superglue storage is mounted _SG=/mnt/sg ## htdocs to bind to _HTDOCS=/www/htdocs ## mount if needed while ! mountpoint -q $_HTDOCS; do [ $n -gt 30 ] && break; mount --bind $_SG/htdocs $_HTDOCS; let n++ done unset n mountpoint -q $_HTDOCS || ( echo 'failed to mount HTDOCS..'; exit 1; ) ## if /www/htdocs is mounted, then.. ## if not writable chown with httpd [ $(stat $_HTDOCS -c %U) != 'httpd' ] && chown -R httpd $_HTDOCS [ $(stat $_HTDOCS -c %a) -lt '755' ] && chmod -R u+rwX $_HTDOCS ## check if index.html is present [ -e $_HTDOCS/index.html ] || ( cp /www/lib/resources/demo.html $_HTDOCS/default.html chown httpd $_HTDOCS/default.html ) ## check for log directory [ -e /www/log ] || ( mkdir /www/log chown httpd /www/log /etc/init.d/lighttpd reload ) ## check for tmp directory [ -e /www/tmp ] || ( mkdir /www/tmp chown httpd /www/tmp ) exit 0