RedHat7でシャットダウン/再起動を開始する前にスクリプトを実行する方法の解決策を見つけたいと思います。サーバーをシャットダウンまたは再起動するときは、SAPデータベースを正しくシャットダウンする必要があります。
SAPシャットダウンスクリプトは3〜4分かかりますが、システムは非常に迅速にシャットダウンします。つまり、RedHat はすべてのプロセスをただちに終了します。
私のもの
systemd sap.service は次のようになります。
[Unit]
Description=Shutdown SAP
Before=shutdown.target reboot.target halt.target
[Service]
ExecStart=/bin/true
ExecStop=/usr/sap/stopsap
RemainAfterExit=true
KillMode=none
[Install]
WantedBy=multi-user.target
終了ログに示すように、データベースが正常に終了しませんでした。
Checking ADA Database
-------------------------------------------
setTrace: false
J2EE Database is not available
助けてください?
ありがとう
イボ
2015年10月21日に修正:
次のステップに進みます。うまくいきますが、まだ正しくありません。
[Unit] Description=SAP sluzba
After=network.target sshd.target Wants=network.target sshd.service
[Service] Type=simple RemainAfterExit=true
Environment="SAPSYSTEMNAME=RH7" "HOST=cz-brn1-rh7" "HOME=/home/rh7adm"
"PATH=/sapdb/clients/RH7/bin:/sapdb/programs/bin:/usr/lib64/qt-.3/bin:/usr/local/bin:/bin:/usr/bin:/usr/local/sbin:/usr/sbin:/usr/sap/RH7/SYS/exe/uc/linuxx86_64:/usr/sap/RH7/SYS/exe/run:/home/rh7adm:."
"DIR_LIBRARY=/usr/sap/RH7/SYS/exe/run"
"LD_LIBRARY_PATH=/usr/sap/RH7/SYS/exe/run:/usr/sap/RH7/SYS/exe/uc/linuxx86_64:/sapdb/clients/RH7/lib"
"RSEC_SSFS_DATAPATH=/usr/sap/RH7/SYS/global/security/rsecssfs/data"
"RSEC_SSFS_KEYPATH=/usr/sap/RH7/SYS/global/security/rsecssfs/key"
KillMode=none SendSIGKILL=no TimeoutSec=5min TimeoutStopSec=5min
User=rh7adm Group=sapsys
ExecStart=/usr/sap/startsap
ExecStop=/usr/sap/stopsap
[Install] WantedBy=graphical.target
stopapスクリプトは次のとおりです。
#!/bin/bash
date >> /usr/sap/stopsap.log; /usr/sap/RH7/SYS/exe/uc/linuxx86_64/stopsap >> /usr/sap/stopsap.log 2>&1; whoami >> /usr/sap/stopsap.log;
J2EE Database is running
See logfile /home/rh7adm/JdbcCon.log
stopping the SAP instance J28
Shutdown-Log is written to /home/rh7adm/stopsap_J28.log
/usr/sap/RH7/J28/exe/sapcontrol -prot NI_HTTP -nr 28 -function Stop
Instance on host cz-brn1-rh7 stopped
Waiting for cleanup of resources..................................................................................................................................................
ここでは5分間停止します。終了スクリプトは完了しません。 :(
樹液がどのように閉じられるかを追跡できますか?提供する?
ありがとうございます..
ベストアンサー1
TimeoutStopSec
ユニットファイルの値を変更してみてください。デフォルトは項目/etc/systemd/system.conf
に設定されていますDefaultTimeoutStopSec
(私のシステムでは90秒に設定されています)。終了を完全に無効にするタイムアウトを設定するかTimeoutStopSec=0
(スクリプトが終了しないと終了を中止する可能性があります)、スクリプトが完全に完了しないように大きな値を渡すことができます。