123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051 |
- #!/bin/bash
- function err {
- printf %s": "%s"\n" "$(basename $0)" "$1"
- exit 1
- }
- _WWW="/www"
- while ! mountpoint -q $_WWW; do [[ $n -gt 30 ]] && err 'failed to mount /www..';
- sleep 2
- block mount &>/dev/null
- let n++
- done
- _HTDOCS="$_WWW/htdocs"
- [[ -e $_HTDOCS ]] || { mkdir $_HTDOCS; let E++; }
- [[ $(stat $_HTDOCS -c %U) == 'httpd' ]] || { chown -R httpd $_HTDOCS; let E++; }
- [[ ! $(stat $_HTDOCS -c %a) -lt '755' ]] || { chmod -R u+rwX $_HTDOCS; let E++; }
- [[ -e $_HTDOCS/index.html ]] || (
- cp /opt/lib/resources/demo.html $_HTDOCS/default.html
- chown httpd $_HTDOCS/default.html
- )
- [[ -e $_WWW/log ]] || {
- mkdir $_WWW/log;
- chown httpd $_WWW/log;
- let E++; }
- [[ -e $_WWW/tmp ]] || {
- mkdir $_WWW/tmp;
- chown httpd $_WWW/tmp;
- let E++; }
- [[ -z $E ]] || (
- echo 'reloading lighttpd'
- /etc/init.d/lighttpd reload
- )
|