
/etc/init.d의 시작 스크립트가 사용할 루트가 아닌 소유 디렉토리를 /var/run에 생성해야 합니다. 이것을 달성하는 올바른 방법은 무엇입니까? 우분투 14.04를 사용하고 있습니다.
답변1
즉석에서 그렇게해야합니다. /var/run/
tmpfs이므로 부팅할 때마다 다시 생성됩니다.
초기화 스크립트에서:
- 내부에 디렉터리를 만들고
/var/run/
해당 사용자에게 권한을 변경합니다. /var/run/mydaemon
그런 다음 대신 사용하도록 지정합니다/var/run
.
이 검사를 수행하는 방법에 대한 예를 원한다면(더 많은 것이 있습니다):
/etc/init.d/ssh
/etc/init.d/bind9
/etc/init/dbus.conf
/etc/init/ssh.conf
/etc/init/cups.conf
그들 모두는 mkdir
그 안에 어떤 종류의 것을 가지고 있습니다. cup.conf:
mkdir -p /var/run/cups/certs
/etc/init/cups.conf
pre-start script
[ -x /usr/sbin/cupsd ]
# load modules for parallel port support
if [ -r /etc/default/cups ]; then
. /etc/default/cups
fi
if [ "$LOAD_LP_MODULE" = "yes" -a -f /usr/lib/cups/backend/parallel \
-a -f /proc/modules -a -x /sbin/modprobe ]; then
modprobe -q -b lp || true
modprobe -q -b ppdev || true
modprobe -q -b parport_pc || true
fi
mkdir -p /var/run/cups/certs
if [ -x /lib/init/apparmor-profile-load ]; then
/lib/init/apparmor-profile-load usr.sbin.cupsd
fi
end script