システム設定の要/etc/rc.conf
FreeBSDのサービス管理の特徴の一つに、
# server
defaultrouter="X.X.X.X"
hostname="parancell.ongs.co.jp"
ifconfig_bge0="inet Y.Y.Y.Y netmask Z.Z.Z.Z up"
dumpdev="AUTO"
zfs_enable="YES"
clear_tmp_enable="YES"
powerd_enable="YES"
# jail
jail_enable="YES"
# ntp
ntpd_enable="YES"
# sshd
sshd_enable="YES"
sshd_flags="-oUsePAM=no -oChallengeResponseAuthentication=no -oUseDNS=no"
# smartd
smartd_enable="YES"
# nfs
nfs_client_enable="YES"
rpcbind_enable="YES"
rpc_statd_enable="YES"
rpc_lockd_enable="YES"
nfs_server_enable="YES"
nfs_server_flags="-u -t -n 4"
nfsd_enable="YES"
mountd_enable="YES"
# Nginx
nginx_enable="YES"
# ipfw
firewall_enable="YES"
firewall_quiet="YES"
firewall_type="OPEN"
FreeBSDプロジェクトはFreeBSD 5系でNetBSD由来のサービス制御システムを移植しました。システム起動時のソフトウェアの自動アップデート、
# service ntpd start Starting ntpd. #
# service ntpd stop Stopping ntpd. Waiting for PIDS: 22889. #
# service ntpd restart Stopping ntpd. Waiting for PIDS: 734. Starting ntpd. #
# service ntpd help /etc/rc.d/ntpd: unknown directive 'help'. Usage: /etc/rc.d/ntpd [fast|force|one|quiet](start|stop|restart|rcvar|enabled|status|poll) #
service(8)コマンド経由で実行される制御スクリプトは/etc/
# ls /etc/rc.d/ DAEMON initrandom pflog FILESYSTEMS ip6addrctl pfsync LOGIN ipfilter postrandom NETWORKING ipfs power_profile SERVERS ipfw powerd abi ipmon ppp accounting ipnat pppoed addswap ipropd_master pwcheck adjkerntz ipropd_slave quota amd ipsec random apm ipxrouted rarpd apmd iscsictl rctl archdep iscsid resolv atm1 jail rfcomm_pppd_server atm2 kadmind root atm3 kdc route6d auditd keyserv routed auditdistd kfd routing automount kld rpcbind automountd kldxref rtadvd autounmountd kpasswdd rtsold bgfsck ldconfig rwho bluetooth local savecore bootparams local_unbound sdpd bridge localpkg securelevel bsnmpd lockd sendmail bthidd lpd serial ccd mdconfig sppp cleanvar mdconfig2 sshd cleartmp mixer statd cron motd static_arp ctld mountcritlocal static_ndp ddb mountcritremote stf defaultroute mountd swap devd mountlate swaplate devfs moused syscons dhclient mroute6d sysctl dmesg mrouted syslogd dumpon msgs timed faith natd tmp fsck netif ubthidhci ftp-proxy netoptions ugidfw ftpd netwait utx gbde newsyslog var geli nfscbd virecover geli2 nfsclient watchdogd gptboot nfsd wpa_supplicant gssd nfsuserd ypbind hastd nisdomain yppasswdd hcsecd nscd ypserv hostapd nsswitch ypset hostid ntpd ypupdated hostid_save ntpdate ypxfrd hostname othermta zfs inetd pf zvol #
パッケージやPorts Collection経由でインストールしたサードパーティ製のソフトウェアの制御スクリプトは/usr/
# tree /usr/local/etc/rc.d/ /usr/local/etc/rc.d/ |-- git_daemon |-- mdnsd |-- mdnsresponderposix |-- nginx |-- smartd \`-- svnserve 0 directories, 6 files # file /usr/local/etc/rc.d/* /usr/local/etc/rc.d/git_daemon: POSIX shell script, ASCII text executable /usr/local/etc/rc.d/mdnsd: POSIX shell script, ASCII text executable /usr/local/etc/rc.d/mdnsresponderposix: POSIX shell script, ASCII text executable /usr/local/etc/rc.d/nginx: POSIX shell script, ASCII text executable /usr/local/etc/rc.d/smartd: POSIX shell script, ASCII text executable /usr/local/etc/rc.d/svnserve: POSIX shell script, ASCII text executable #
/usr/
/etc/rc.confの利点と欠点
なにごとにも利点と欠点があるように、
- このファイルだけでシステム設定の多くを知ることができる
- 人間にとって扱いやすい
これに対して次のような欠点があります。
- 設定内容が膨れあがってくると把握も管理も面倒になってくる
- ソフトウェアにとって扱いにくい
/etc/
分割配置のための/etc/rc.conf.d/と/usr/local/etc/rc.conf.d/
/etc/
sshd_enable="YES"
sshd_flags="-oUsePAM=no -oChallengeResponseAuthentication=no -oUseDNS=no"
nginx_enable="YES"
/etc/
この方法はChefやPuppetのような管理ツール、
/etc/
設定ファイルを単一のファイルにまとめるか、