ubuntu 安装qmail配合的 deamontools时添加自动启动失效

Creating /service...
Adding svscanboot to /etc/rc.local...
Reboot now to start svscan.
root@chrd-edm:/package/admin/daemontools-0.76# reboot

 

安装成功.提示重启,

Broadcast message from chrd@chrd-edm
        (/dev/pts/3) at 23:01 ...

The system is going down for reboot NOW!
root@chrd-edm:/package/admin/daemontools-0.76# Linux chrd-edm 2.6.32-28-server #55-Ubuntu SMP Mon Jan 10 23:57:16 UTC 2011 x86_64 GNU/Linux
Ubuntu 10.04.2 LTS

Welcome to the Ubuntu Server!
 * Documentation:  http://www.ubuntu.com/server/doc

Your CPU appears to be lacking expected security protections.
Please check your BIOS settings, or for more information, run:
  /usr/bin/check-bios-nx --verbose

  System information as of Fri Oct 28 23:03:03 CST 2011

  System load:  0.61              Processes:           104
  Usage of /:   1.5% of 64.00GB   Users logged in:     0
  Memory usage: 3%                IP address for eth0: 124.254.88.171
  Swap usage:   0%                IP address for eth1: 192.168.21.19
  Temperature:  8 C

  Graph this data and manage this system at https://landscape.canonical.com/

Last login: Fri Oct 28 22:51:52 2011 from 88.31.122.86
chrd@chrd-edm:~$ sudo su
[sudo] password for chrd:
Sorry, try again.
[sudo] password for chrd:
root@chrd-edm:/home/chrd# vi /var/qmail/rc
ing stdout for logging
# Using control/defaultdelivery from qmail-local to deliver messages by default

exec env - PATH="/var/qmail/bin:$PATH" \
qmail-start "`cat /var/qmail/control/defaultdelivery`"
~
~
~
~
~
~
~
~
~
root@chrd-edm:/home/chrd# vi /var/qmail/rc
#!/bin/sh

# Using stdout for logging
# Using control/defaultdelivery from qmail-local to deliver messages by default

exec env - PATH="/var/qmail/bin:$PATH" \
qmail-start "`cat /var/qmail/control/defaultdelivery`"
~
~
~
~
~
~
~
"/var/qmail/rc" [New] 7L, 215C written                                                                                                              
root@chrd-edm:/home/chrd# ps -A | grep sv

 

重启完成后,并没有启动svc

root@chrd-edm:/home/chrd# vi /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.

exit 0

csh -cf '/command/svscanboot &'

 

查看rc.local发现它把无条件退出放到第一行.就是不会再执行后面的语句了

 

root@chrd-edm:/home/chrd#  /etc/rc.local
bash: /etc/rc.local: Permission denied
root@chrd-edm:/home/chrd# chmod 700 /etc/rc.local
root@chrd-edm:/home/chrd#  /etc/rc.local
root@chrd-edm:/home/chrd# ps -A | grep
Usage: grep [OPTION]... PATTERN [FILE]...
Try `grep --help' for more information.
root@chrd-edm:/home/chrd# ps -A | grep sv

 

测试确实如此


root@chrd-edm:/home/chrd# wget http://www.qmail.org/netqmail-1.06.tar.gz

 

 

 

 

 

 

 

root@chrd-edm:/home/chrd# vi /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.

exit 0

csh -cf '/command/svscanboot &'
root@chrd-edm:/home/chrd#  /etc/rc.local
bash: /etc/rc.local: Permission denied
root@chrd-edm:/home/chrd# chmod 700 /etc/rc.local
root@chrd-edm:/home/chrd#  /etc/rc.local
root@chrd-edm:/home/chrd# ps -A | grep
Usage: grep [OPTION]... PATTERN [FILE]...
Try `grep --help' for more information.
root@chrd-edm:/home/chrd# ps -A | grep sv
root@chrd-edm:/home/chrd# vi /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.

#exit 0

csh -cf '/command/svscanboot &'

# must put exit 0

exit 0

 

 

 

进行修改

 


"/etc/rc.local" 21L, 368C written                                                                                                                   
root@chrd-edm:/home/chrd# reboot
重启
Broadcast message from chrd@chrd-edm
        (/dev/pts/0) at 23:14 ...

The system is going down for reboot NOW!
root@chrd-edm:/home/chrd# Linux chrd-edm 2.6.32-28-server #55-Ubuntu SMP Mon Jan 10 23:57:16 UTC 2011 x86_64 GNU/Linux
Ubuntu 10.04.2 LTS

Welcome to the Ubuntu Server!
 * Documentation:  http://www.ubuntu.com/server/doc

Your CPU appears to be lacking expected security protections.
Please check your BIOS settings, or for more information, run:
  /usr/bin/check-bios-nx --verbose

  System information as of Fri Oct 28 23:16:12 CST 2011

  System load:  0.2               Processes:           102
  Usage of /:   1.5% of 64.00GB   Users logged in:     0
  Memory usage: 3%                IP address for eth0: 124.254.88.171
  Swap usage:   0%                IP address for eth1: 192.168.21.19
  Temperature:  8 C

  Graph this data and manage this system at https://landscape.canonical.com/

Last login: Fri Oct 28 23:03:03 2011 from 58.31.122.86
chrd@chrd-edm:~$ sudo su
[sudo] password for chrd:
root@chrd-edm:/home/chrd# ps -A | grep sv

 

重启了还是没有
root@chrd-edm:/home/chrd# vi /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.

#exit 0
root@chrd-edm:/home/chrd# /etc/rc.local
/etc/rc.local: 16: csh: not found

 

运行时发现提示没有csh
root@chrd-edm:/home/chrd# which csh

安装
root@chrd-edm:/home/chrd# apt-get install csh
Reading package lists... Done
Building dependency tree       
Reading state information... Done
The following NEW packages will be installed:
  csh
0 upgraded, 1 newly installed, 0 to remove and 79 not upgraded.
Need to get 258kB of archives.
After this operation, 418kB of additional disk space will be used.
Get:1 http://cn.archive.ubuntu.com/ubuntu/ lucid/universe csh 20070713-2ubuntu1 [258kB]
Fetched 258kB in 3s (73.7kB/s)
Selecting previously deselected package csh.
(Reading database ... 46028 files and directories currently installed.)
Unpacking csh (from .../csh_20070713-2ubuntu1_amd64.deb) ...
Processing triggers for man-db ...
Setting up csh (20070713-2ubuntu1) ...
update-alternatives: using /bin/bsd-csh to provide /bin/csh (csh) in auto mode.

root@chrd-edm:/home/chrd# which csh
/bin/csh
root@chrd-edm:/home/chrd# /etc/rc.local

 

再次运行有了

 

[1] 1006
root@chrd-edm:/home/chrd# ps -A | grep sv
 1006 pts/0    00:00:00 svscanboot
 1008 pts/0    00:00:00 svscan
root@chrd-edm:/home/chrd# csh

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值