Ubuntu10.10 自宅サーバ構築手順:GlassFish3.0.1 サービス起動設定
全面的に以下のサイトを参考にさせて頂きました。感謝。
#!/bin/sh ### BEGIN INIT INFO # Provides: glassfish # Required-Start: $local_fs $remote_fs $network $syslog # Required-Stop: $local_fs $remote_fs $network $syslog # Default-Start: 2 3 4 5 # Default-Stop: S 0 1 6 # Short-Description: StartUP and Shutdown for GlassFish v3 Prelude. # Description: Written by Doitaroh ### END INIT INFO . /lib/lsb/init-functions case "$1" in start) log_daemon_msg "Starting application server" "glassfish" /opt/glassfishv3/bin/asadmin start-domain domain1 ;; restart) /opt/glassfishv3/bin/asadmin stop-domain domain1 log_daemon_msg "Stopping application server" "glassfish" log_daemon_msg "Starting application server" "glassfish" /opt/glassfishv3/bin/asadmin start-domain domain1 ;; stop) /opt/glassfishv3/bin/asadmin stop-domain domain1 log_daemon_msg "Stopping application server" "glassfish" ;; *) ;; esac
- 所有者及び実行権限の変更。
absj31@absj31-MyHomeServer:/$ sudo chown root:root /etc/init.d/glassfish absj31@absj31-MyHomeServer:/$ sudo chmod 775 /etc/init.d/glassfish
- 『 update-rc.d』コマンドを使って起動設定を組み込む。
absj31@absj31-MyHomeServer:/$ sudo update-rc.d glassfish defaults 92 08 update-rc.d: warning: glassfish stop runlevel arguments (0 1 6) do not match LSB Default-Stop values (S 0 1 6) Adding system startup for /etc/init.d/glassfish ... /etc/rc0.d/K08glassfish -> ../init.d/glassfish /etc/rc1.d/K08glassfish -> ../init.d/glassfish /etc/rc6.d/K08glassfish -> ../init.d/glassfish /etc/rc2.d/S92glassfish -> ../init.d/glassfish /etc/rc3.d/S92glassfish -> ../init.d/glassfish /etc/rc4.d/S92glassfish -> ../init.d/glassfish /etc/rc5.d/S92glassfish -> ../init.d/glassfish absj31@absj31-MyHomeServer:/$
- 設定が完了すると、以下のコマンドで操作及びOS起動時にもglassfishが起動するようになる。
sudo /etc/init.d/glassfish start sudo /etc/init.d/glassfish stop sudo /etc/init.d/glassfish restart