
私のrc.localに次の行があります
#!/bin/sh -e
#
# rc.local
#
# This script is executed at the end of each multiuser runlevel.
# Make sure that the script will "exit 0" on success or any other
# value on error.
#
# In order to enable or disable this script just change the execution
# bits.
#
# By default this script does nothing.
if [ -f /resize ]
then
if [ -f /resize2 ]
then
sh /resize2
else
sh /resize
fi
fi
/etc/rc --foreground
/sbin/iptables-restore /etc/iptables
mkdir /tmp/cooks
mkdir /tmp/cook
chmod 777 /tmp/cook
chmod 777 /tmp/cooks
mkdir /tmp/xhprof
chmod 777 /tmp/xhprof
exit 0
ただし、システム起動時にnor/tmp/cooks
も/tmp/cook
dirも生成されません。/tmp/xhprof
私はそれを使用していますDebian GNU/Linux 6.0 squeeze (VPS)
答え1
スクリプトは#!/bin/sh -e
。この-e
オプションは、コマンドがゼロ以外の状態を返すとシェルが終了することを意味します。コマンドのいずれかが失敗した可能性があります。多分/resize
または/resize2
ゼロ以外の値を返すか、多分または/etc/rc
を返しますiptables-restore
。 Shebang行を次に変更して#!/bin/sh -ex
スクリプトを実行すると、実行されるコマンドのトレースを表示できます。
コマンドのいずれかが成功する必要があるときにゼロ以外の値を返す場合は、それを修正してください。ゼロ以外の値を正当に返すコマンドの1つが見つかった場合は、|| true
そのコマンドの後に追加します。コマンドの戻り状態に興味がない場合は、そのコマンドを削除してください-e
。