以下是我的rc.local文件的內容。當我運行sudo /etc/rc.local時,它工作正常。當我啓動和實例。我期望安裝monit,但事實並非如此。我處於全面虧損狀態。我通常使用rc.local,但這相當混亂。ec2上的ubuntu上的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.
apt-get -y install monit
/etc/init.d/monit stop
cd /home/ubuntu/workspace/rtbopsConfig/
git fetch
git checkout origin/master rtb_ec2_boot/ec2_boot.py
git checkout origin/master config/
cp /home/ubuntu/workspace/rtbopsConfig/config/monit/redis/monitrc /etc/monit/
/usr/bin/python /home/ubuntu/workspace/rtbopsConfig/rtb_ec2_boot/ec2_boot.py >> /home/ubuntu/workspace/ec2_boot.txt 2>&1
/etc/init.d/monit start
chkconfig monit on
exit 0
感謝。我嘗試過但仍然無濟於事。這很奇怪。 – Tampa 2012-03-25 17:16:59
請提供更多的細節,當你用這兩行啓動rc.local時會發生什麼並重啓。文件/var/log/rc.local.log是否被創建?它包含什麼? – 2012-03-26 16:55:51
我注意到了相同的行爲。重啓後不會調用/etc/rc.local – mark 2012-09-12 12:01:31