В дополнение к основанному на IP хостингу поставщики услуг хостинга предлагают основанный на имени хостинг, который позволяет нескольким доменам подаваться от каждого IP-адреса.
В Apache, например, можно настроить любой тип с помощью Виртуальных Хостов.
В конфигурационном файле такой как /etc/apache2/sites-available/default
для основанного на IP хоста:
ServerAdmin webmaster@mail.smallco.com
DocumentRoot /groups/smallco/www
ServerName www.smallco.com
ErrorLog /groups/smallco/logs/error_log
TransferLog /groups/smallco/logs/access_log
или основанный на имени хост:
NameVirtualHost *:80
ServerName www.domain.tld
ServerAlias domain.tld *.domain.tld
DocumentRoot /www/domain
When a filesystem is mounted the mount point acquires the permissions of the root inode of that filesystem. If a filesystem is not mounted the directory acting as the mount point is just another directory on the parent filesystem.
You can use this fact to your advantage to prevent accidentally writing to a mount point which may not be mounted:
chmod 0000 /path/to/mountpoint
should work nicely.Note that this doesn't work so well if root
is doing the writing and the usual permissions checks are bypassed.
You may be able to do something similar with immutable
flags (schg
or uchg
on BSD systems, the i
attribute on Linux systems) but I've not tested the behavior of filesystem attributes personally. Intuitively they should work the same as filesystem permissions do though.
Note that ideally you'd want to modify your backup scripts to ensure that the appropriate filesystem is mounted, otherwise you're going to have to catch and handle the errors the solutions above will generate.
Detecting that the appropriate filesystem(s) aren't in the output of mount
may be a more robust solution.
Типичным решением будет проверка в вашем сценарии, например, с помощью команды mountpoint
.
if mountpoint -q $dir ; then
echo "$dir is not mounted"
exit 1
else
echo "$dir is mounted"
fi
Альтернативой может быть проверка с stat
:
if [ `stat -fc%t:%T "$dir"` != `stat -fc%t:%T "$dir/.."` ]; then
echo "$dir is mounted"
else
echo "$dir is not mounted"
exit 1
fi
Немного устарело, но на случай, если кто-то еще найдет это.
См. /Etc/rsnapshot.conf[1289 sizes