0

Linux ディストリビューション (opensuse 12.2) の起動時に Oracle を起動しようとしています。手動で実行すると、スクリプトは正常に機能します。しかし、再起動しても何も起こりません。inserv を実行すると、以下のメッセージが表示されます。

dbora' overwrites defaults (2 3 4 5). insserv: warning: current stop runlevel(s) (empty) of scriptinsserv: 警告: スクリプトdbora'の現在の開始ランレベル (3 5) がデフォルト (2 3 4 5) を上書きします。

ここにスクリプトがあります:

#!/bin/bash

### BEGIN INIT INFO
# Provides:          my_oracle_database
# Required-Start:    $local_fs $syslog
# Required-Stop:     $local_fs $syslog
# Default-Start:     2 3 4 5
# Default-Stop:      0 1 6
# Short-Description: my_oracle_database
# Description:       my_oracle_database
### END INIT INFO
export PATH=/oracle10/product/10.2.0/bin:$PATH
case "$1" in 
     start | startup | go | on)
        su - oracle -c "/oracle10/product/10.2.0/bin/lsnrctl start"
        su - oracle -c /oracle10/product/10.2.0/bin/dbstart /oracle10/product/10.2.0/  
        ;; 
     stop | shutdown | halt | off)
        su - oracle -c "/oracle10/product/10.2.0/bin/lsnrctl stop"
        su - oracle -c /oracle10/product/10.2.0/bin/dbshut /oracle10/product/10.2.0/  
        ;; 
     *)
        ;; 
esac
4

1 に答える 1

0

あなたの問題はおそらくこれらの行です:

su - oracle -c /oracle10/product/10.2.0/bin/dbstart /oracle10/product/10.2.0/
...
su - oracle -c /oracle10/product/10.2.0/bin/dbshut /oracle10/product/10.2.0/

suデフォルトでは、-cオプションを使用して指定されたコマンドを実行し/bin/sh、 usernaem を除く他のすべての位置引数をシェルに渡します ( as $0$1、...):

# su nobody -c 'echo prog:$0 args:$@' a b c d
prog:a args:b c d

スクリプトでは、コマンドを囲む引用符が欠落しているため、シェルへのパスを として渡しながら、パラメーターなしでdbstart/を実行しています。dbshut$0

于 2012-11-06T18:24:38.040 に答える