rc.local - すべてのコマンドが実行されるわけではありません。

rc.local - すべてのコマンドが実行されるわけではありません。

私の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/cookdirも生成されません。/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

おすすめ記事