Ubuntu 12.04.1 LTS rc.local里面的脚本,不自动执行

系统安装、升级讨论
版面规则
我们都知道新人的确很菜,也喜欢抱怨,并且带有浓厚的Windows习惯,但既然在这里询问,我们就应该有责任帮助他们解决问题,而不是直接泼冷水、简单的否定或发表对解决问题没有任何帮助的帖子。乐于分享,以人为本,这正是Ubuntu的精神所在。
回复
mtc_ubuntu
帖子: 3
注册时间: 2013-02-01 14:46
系统: ubuntu-server 12.04

Ubuntu 12.04.1 LTS rc.local里面的脚本,不自动执行

#1

帖子 mtc_ubuntu » 2013-02-01 14:56

最近我选用了Ubuntu 12.04.1 LTS server版操作系统,在该系统上部署了android_sdk环境。由于有些自动化的命令,需要开机自动运行,我选择了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.
sleep 10
echo "nameserver 172.22.1.253" >> /etc/resolv.conf
echo "nameserver 172.22.1.254" >> /etc/resolv.conf


#ifconfig eth0:0 172.21.2.230/25 up
#route add -net 172.21.2.224/27 dev eth0:0

#nohup sh /home/work/mtctools/restart.sh &
sh /home/work/mtctools/restart.sh &
#/usr/sbin/apache2ctl start
#nohup sh /home/dom/dom/autojoin.sh &
#cd /home/work/mtctools/newda/
#nohup ./bin/start-da.sh &
sh /home/work/mtctools/newda/bin/start-da.sh &

/home/work/mtctools/CheckPhone/supervise -p /home/work/mtctools/CheckPhone/status/adb -f "/usr/bin/adb fork-server server"

exit 0
头像
百草谷居士
帖子: 3921
注册时间: 2006-02-10 16:36
系统: Mint21.1/Deepin20.8

Re: Ubuntu 12.04.1 LTS rc.local里面的脚本,不自动执行

#2

帖子 百草谷居士 » 2013-11-01 9:36

楼主找到答案了吗?
我的ubuntu server版似乎能够执行rc.local的命令。但是桌面版不行,很奇怪的事情。
debian 12 / 深度系统 20.9 / Mint 21.3

为何热衷于搞发行版的多,搞应用程序开发的少?Linux最多余的就是各种发行版,最缺的就是应用程序,特别是行业应用程序。
头像
TeliuTe
论坛版主
帖子: 7668
注册时间: 2007-11-25 13:29
系统: 16/18/20/w7
来自: 新疆博乐
联系:

Re: Ubuntu 12.04.1 LTS rc.local里面的脚本,不自动执行

#3

帖子 TeliuTe » 2013-11-01 10:09

我用的桌面版有些可以执行,像用at命令的定时停止XAMPP、定时关机,
另一些则没有看到效果,像numlockx登录前开启数字小键盘的,以及关闭squid3的命令
回复