如何让程序和apache服务一样随系统启动

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

如何让程序和apache服务一样随系统启动

#1

帖子 liuxuwen » 2008-11-14 18:39

因为在局域网做WEB服务器,所以想自动开机后自动连接锐捷。
已经有锐捷自动连接的脚本,在 系统 - 首选项 - 会话 添加启动程序后,只能实现用户登录后自动连接 ── 即需要输入用户名和密码登录图形界面,才能自动连接。

有没有办法让 程序 和 apapche 服务器一样,在用户登录之前就启动?
头像
Element
帖子: 3537
注册时间: 2005-09-10 16:04
来自: DG-GD-China

Re: 如何让程序和apache服务一样随系统启动

#2

帖子 Element » 2008-11-14 21:45

rc.d里启动?
http://element.blog.ubuntu.org.cn/
Ubuntu Jaunty Jackalope...
AMD Barton 2600+
MSI K7N2 Delta-L
Kingston DDR400 512M*2+256M*1
nVidia FX5200
Seagate 80G(Jaunty Jackalope)
Seagate 160G(XXxxXX)
SyncMaster 732N
头像
heshuaikun
帖子: 550
注册时间: 2008-09-07 23:44

Re: 如何让程序和apache服务一样随系统启动

#3

帖子 heshuaikun » 2008-11-15 10:26

假如你要运行的脚本叫aaa.script ,放在/etc目录下,你可以编辑/etc/rc.local在exit 0之前加一行
sh /etc/aaa.script
头像
liuxuwen
帖子: 63
注册时间: 2007-10-22 21:48
来自: Hell Mainland
联系:

Re: 如何让程序和apache服务一样随系统启动

#4

帖子 liuxuwen » 2008-11-15 11:26

谢谢楼上二位,我已经在 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.

sh /usr/local/bin/connect
sh /usr/local/bin/down

exit 0
顺便帮我看看,我的关机脚本是否有错误。

代码: 全选

#!/usr/bin/expect
spawn su - -c "shutdown -h 2:30"
expect "口令:"
send "lxw4335519\r"
expect "The system is going down for halt in 60 minutes!"
sleep 3600000
#end
头像
liuxuwen
帖子: 63
注册时间: 2007-10-22 21:48
来自: Hell Mainland
联系:

Re: 如何让程序和apache服务一样随系统启动

#5

帖子 liuxuwen » 2008-11-16 21:33

自己顶一下。
头像
xhy
帖子: 3916
注册时间: 2005-12-28 1:16
系统: Ubuntu 12.10 X64
来自: 火星

Re: 如何让程序和apache服务一样随系统启动

#6

帖子 xhy » 2008-11-16 21:37

expect EOF
目前负债150多万
头像
heshuaikun
帖子: 550
注册时间: 2008-09-07 23:44

Re: 如何让程序和apache服务一样随系统启动

#7

帖子 heshuaikun » 2008-11-16 22:25

查下系统日志。查下脚本的运行权限。
头像
heshuaikun
帖子: 550
注册时间: 2008-09-07 23:44

Re: 如何让程序和apache服务一样随系统启动

#8

帖子 heshuaikun » 2009-01-02 23:56

好几百年以后再翻出这个贴。然后看到这个

代码: 全选

#!/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.

sh /usr/local/bin/connect
sh /usr/local/bin/down

exit 0
发现这不是没有连接,而是先连接然后关闭了。
头像
xc1427
帖子: 276
注册时间: 2008-10-11 4:11
来自: 瑞金无线电学校
联系:

Re: 如何让程序和apache服务一样随系统启动

#9

帖子 xc1427 » 2009-01-03 1:32

图形界面下就可以解决:
系统->首选项->会话
如果你语言是英文,那么System->Preference->Session
You never know if you don't try
头像
Jarson
帖子: 2371
注册时间: 2008-07-21 9:44
来自: 深圳
联系:

Re: 如何让程序和apache服务一样随系统启动

#10

帖子 Jarson » 2009-01-03 11:19

帮顶,不知LZ的问题解决来没? :em20
回复