suse 开机启动问题

sankby 2012-01-18 04:33:46
suse Linux 11
想添加一个开机启动的脚本执行:
在/etc/init.d新建一个autorun脚本如下,当前的runlevel看了一下是5。
在rc3.d和rc5.d中建了autorun的软连接S99autorun。
使用chkconfig --list autorun 看是
autorun 0:off 1:off 2:off 3:on 4:off 5:on 6:off

chkconfig |grep autorun
autorun 35

chkconfig autorun on
...
insserv: warning: current start runlevel(s) (3 5 6) of script `autorun' overwrites defaults (2 3 4 5).
...
insserv: exiting without changing boot order!
/sbin/insserv failed, exit code 1

reboot 之后:
chkconfig |grep autorun
autorun 35
但是自定义的脚本没有执行,哪位高人帮忙看看是怎么弄的。
晚上查的都是这么搞的,就只启动不了啊。


#! /bin/bash


# Comments to support LSB init script conventions
### BEGIN INIT INFO
# Provides: watchdog
# Required-Start: $local_fs $network $remote_fs
# Should-Start: ypbind nscd ldap ntpd xntpd
# Required-Stop: $local_fs $network $remote_fs
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: start and stop watchdog
# Description: watchdog
### END INIT INFO

echo "start watchdog `date`" >dog.txt
PRG="/home/auto.sh"
LOG="/home/alog.txt"

case "$1" in
start)

if [ ! -f $PRG ]; then
echo "programe not exists!" >>$LOG
else
echo "Starting user defined startup programes" "$PRG" >>$LOG
$PRG >>dog.txt
exit 0;
fi
;;
stop)
echo "Stop user defined startup programes, nothing to do here" "$PRG" >>$LOG
;;
restart)

echo "Restart user defined startup programes, nothing to do here" "$PRG" >>$LOG
;;
esac
exit 0
...全文
232 1 打赏 收藏 转发到动态 举报
写回复
用AI写文章
1 条回复
切换为时间正序
请发表友善的回复…
发表回复
sankby 2012-01-18
  • 打赏
  • 举报
回复
使用 ./autorun start 是可以运行脚本的

18,771

社区成员

发帖
与我相关
我的任务
社区描述
Linux/Unix社区 专题技术讨论区
社区管理员
  • 专题技术讨论区社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧