AI インストールをテストする前にサービスをテストするには、テストシステムにパッケージをインストールし、そのテストシステムをリブートするだけです。
# pkg install first-boot-script
Packages to install: 1
Create boot environment: No
Create backup boot environment: No
DOWNLOAD PKGS FILES XFER (MB) SPEED
Completed 1/1 2/2 0.0/0.0 0B/s
PHASE ITEMS
Installing new actions 7/7
Updating package state database Done
Updating image state Done
Creating fast lookup database Done
Reading search index Done
# pkg list first-boot-script
NAME (PUBLISHER) VERSION IFO
first-boot-script (firstboot) 1.0-0 i--
# pkg info first-boot-script
Name: first-boot-script
Summary: AI first-boot script
Description: Script that runs at first boot after AI installation
Category: System/Administration and Configuration
State: Installed
Publisher: firstboot
Version: 1.0
Build Release: 5.11
Branch: 0
Packaging Date: Dec 23, 2013 02:50:31 PM
Size: 3.89 kB
FMRI: pkg://firstboot/first-boot-script@1.0,5.11-0:20131223T145031Z
テストシステムをリブートします。スクリプトが上に示したように新しいブート環境を作成したら、必ずその新しいブート環境からブートしてください。
スクリプトが /opt/site ディレクトリ内にあり、スクリプトの効果が正しいことを確認します。
サービスの状態を確認します。スクリプトが完了して正常終了した場合は、サービスが無効な状態になっているはずです。
# svcs first-boot-script-svc STATE STIME FMRI disabled 8:24:16 svc:/site/first-boot-script-svc:default
次のいずれかのコマンドを使用して、completed プロパティーの値を確認します。
# svcprop first-boot-script-svc:default config/completed boolean true # svcprop -p config/completed first-boot-script-svc:default true
サービスのログファイルを確認する場合は、次のコマンドを使用してログファイルの場所を見つけます。
# svcs -x first-boot-script-svc svc:/site/first-boot-script-svc:default (?) State: disabled since Dec 23, 2013 08:24:16 AM PDT Reason: Temporarily disabled by service method: "Configuration completed." See: http://support.oracle.com/msg/SMF-8000-1S See: /var/svc/log/site-first-boot-script-svc:default.log Impact: This service is not running.
ログファイルには次の情報が含まれています。
[ Jul 23 08:22:57 Enabled. ]
[ Jul 23 08:24:14 Executing start method ("/opt/site/first-boot-script.sh"). ]
[ Jul 23 08:24:16 Method "start" exited with status 101. ]
[ Jul 23 08:24:16 "start" method requested temporary disable: "Configuration completed" ]
[ Jul 23 08:24:16 Rereading configuration. ]