自己用源代码编译安装的mysql,如何设置成在系统启动的时候自动启动??
我只会手工启动:/usr/local/mysql/bin/mysqld_safe &
[分享]在ubuntu中把某个程序当系统服务来启动的方法
-
- 帖子: 79
- 注册时间: 2007-05-15 20:40
[分享]在ubuntu中把某个程序当系统服务来启动的方法
上次由 hillking 在 2007-06-02 17:17,总共编辑 2 次。
- jupengfei
- 帖子: 1258
- 注册时间: 2006-10-31 11:02
- 来自: Beijing
-
- 帖子: 79
- 注册时间: 2007-05-15 20:40
-
- 帖子: 79
- 注册时间: 2007-05-15 20:40
因此在ubuntu下想把某个程序设置成自动启动的服务(不一定是msyql/apache,随便一个程序都可以)
需要做到下面几点:
1、要编写一个脚本,这个脚本可以支持start/stop/restart等参数。
例如你的启动脚本是aa.sh,必须要aa.sh start 是启动服务,aa.sh stop
是停止服务。aa.sh restart是重新启动服务(这个好像可以不要,但start/stop一定要)。
2、把aa.sh用root用户sudo cp到/etc/init.d目录。
3、运行sudo bum(如果没有bum,就先sudo apt-get install bum),选中advance项,
在Services选项卡里,选择aa.sh,然后确认就可以了!
以上是我参考了一些资料摸索出来的,有不足的地方请大家指正。
需要做到下面几点:
1、要编写一个脚本,这个脚本可以支持start/stop/restart等参数。
例如你的启动脚本是aa.sh,必须要aa.sh start 是启动服务,aa.sh stop
是停止服务。aa.sh restart是重新启动服务(这个好像可以不要,但start/stop一定要)。
2、把aa.sh用root用户sudo cp到/etc/init.d目录。
3、运行sudo bum(如果没有bum,就先sudo apt-get install bum),选中advance项,
在Services选项卡里,选择aa.sh,然后确认就可以了!
以上是我参考了一些资料摸索出来的,有不足的地方请大家指正。
-
- 帖子: 75
- 注册时间: 2006-05-13 18:08
- 联系:
不用那么复杂, 在 7.04 里面, 可以在 /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.
-
- 帖子: 79
- 注册时间: 2007-05-15 20:40
- marsteel
- 帖子: 555
- 注册时间: 2005-11-28 12:09
- 联系:
- 王子
- 帖子: 226
- 注册时间: 2007-02-01 14:35
- 来自: 中国上海长宁区
- 联系:
cp mysql.server /etc/init.d/mysqld
/usr/sbin/update-rc.d mysqld defaults 99
然后 service mysqld start/stop/restart
或者安装chkconfig,在RH下面习惯用这个。
/usr/sbin/update-rc.d mysqld defaults 99
然后 service mysqld start/stop/restart
或者安装chkconfig,在RH下面习惯用这个。
No acer,no pain
UBUNTU Karmic
TP T61
cpu:Intel T7300
内存:DDRII 4G
显卡:nVIDIA 140M
硬盘:Inel SSD 80G
Email/MSN/GTALK:ahdong.com#gmail.com
Site:Ahdong.com
UBUNTU Karmic
TP T61
cpu:Intel T7300
内存:DDRII 4G
显卡:nVIDIA 140M
硬盘:Inel SSD 80G
Email/MSN/GTALK:ahdong.com#gmail.com
Site:Ahdong.com