想让命令开机自动运行,要怎么做?
- linunix
- 帖子: 424
- 注册时间: 2006-11-21 21:25
想让命令开机自动运行,要怎么做?
我是要运行
/usr/local/gw6c/bin/gw6c
于是把这一行加入了/etc/init.d/rc.local的最后一行,但是无效。
如果手动运行的话,必须得
cd /usr/local/gw6c/bin/gw6c
然后再
sudo ./gw6c
直接运行
sudo /usr/local/gw6c/bin/gw6c的话
就会出现配置文件读取错误。
于是我写了一个shell(自己瞎琢磨的)
内容如下
#!/bin/sh
cd /usr/local/gw6c/bin
./gw6c
cd ~
保存为文件名的gw6c的文件,放在/etc/init.d/目录下。
然后再在/etc/init.d/rc.loca的最后一行加上
/etc/init.d/gw6c
这样似乎就可以了,但是感觉不太好,似乎关机的时候偶尔会提示错误啥的。
请问那个Shell文件要怎么写?
/usr/local/gw6c/bin/gw6c
于是把这一行加入了/etc/init.d/rc.local的最后一行,但是无效。
如果手动运行的话,必须得
cd /usr/local/gw6c/bin/gw6c
然后再
sudo ./gw6c
直接运行
sudo /usr/local/gw6c/bin/gw6c的话
就会出现配置文件读取错误。
于是我写了一个shell(自己瞎琢磨的)
内容如下
#!/bin/sh
cd /usr/local/gw6c/bin
./gw6c
cd ~
保存为文件名的gw6c的文件,放在/etc/init.d/目录下。
然后再在/etc/init.d/rc.loca的最后一行加上
/etc/init.d/gw6c
这样似乎就可以了,但是感觉不太好,似乎关机的时候偶尔会提示错误啥的。
请问那个Shell文件要怎么写?
- solcomo
- 帖子: 2838
- 注册时间: 2007-04-25 13:12
- yiding_he
- 帖子: 2677
- 注册时间: 2006-10-25 18:10
- 来自: 长沙
- 联系:
- yaoms
- 帖子: 4952
- 注册时间: 2007-10-19 14:51
- 来自: 深圳
这是我的,没有出错。$ cat /etc/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.
cd /usr/local/gw6c/bin
./gw6c
exit 0
Nothing 有事请发邮件到 yms541 AT gmail.com
alias 爱慕颇雷尔='mplayer'
alias 爱慕颇雷尔='mplayer'
- linunix
- 帖子: 424
- 注册时间: 2006-11-21 21:25
- linunix
- 帖子: 424
- 注册时间: 2006-11-21 21:25
这个试过了,不行啊,加了sudo 或gksudo也不行。yiding_he 写了:登录GNOME时自动运行程序
http://wiki.ubuntu.org.cn/%E7%99%BB%E5% ... B%E5%BA%8F
- xiehuoli
- 帖子: 5941
- 注册时间: 2006-06-10 8:43
- 来自: 中国 CS
- yaoms
- 帖子: 4952
- 注册时间: 2007-10-19 14:51
- 来自: 深圳
- solcomo
- 帖子: 2838
- 注册时间: 2007-04-25 13:12
- linunix
- 帖子: 424
- 注册时间: 2006-11-21 21:25
可以了,谢了。yaoms 写了:这是我的,没有出错。$ cat /etc/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.
cd /usr/local/gw6c/bin
./gw6c
exit 0
原来是要添加在/etc/rc.local后面
而不是添加在/etc/init.d/rc.local后面
- linunix
- 帖子: 424
- 注册时间: 2006-11-21 21:25
顺便问一个,昨晚我添加了
http://ubuntu.cn99.com/ubuntu-cn/
的源后(用的是软件源的deb命令,而不是修改source.lst文件)
更新了一下,发现关机时不再出现那个进度条画面了,而出了一大串字符界面,似乎是关于network-manager什么的错误。
这是怎么回事?
http://ubuntu.cn99.com/ubuntu-cn/
的源后(用的是软件源的deb命令,而不是修改source.lst文件)
更新了一下,发现关机时不再出现那个进度条画面了,而出了一大串字符界面,似乎是关于network-manager什么的错误。
这是怎么回事?
- linunix
- 帖子: 424
- 注册时间: 2006-11-21 21:25
- bones7456
- 帖子: 8495
- 注册时间: 2006-04-12 20:05
- 来自: 杭州
- 联系: