红联Linux门户
Linux帮助

使用chkconfig命令出现的问题

发布时间:2009-10-13 22:06:05来源:红联作者:01382140
我用的是REDHAT 5 企业版,版本号:2.6.18-53.el5用系统自带的ADSL(版本号rp-pppoe-3.5-32.1)配置上网。chkconfig的版本是:chkconfig-1.3.30.1-1

配置上网成功后想在下次系统启动后自动连接网络,于是在终端输入: chkconfig --add adsl 命令,回车后显示在 “adsl 服务中读取信息时出错:没有那个文件或目录"

这个系统我一直在用,从前网络配置好后经过这样的设置都能自动连接从没出现过这样的现象,但这次是为什么?应该怎么解决?
文章评论

共有 12 条评论

  1. donyinstru 于 2009-10-26 09:03:46发表:

    都是高手啊

  2. deepwhite 于 2009-10-17 08:55:39发表:

    呵呵,建议遇到问题时候多搜索一下,英语不好的话多用点时间学学。很多有用的东西还得需要去找英文的答案。

  3. 01382140 于 2009-10-16 23:59:50发表:

    将以上代码存为/etc/init.d/adsl后修改了权限,问题得以解决。再次感谢版主的帮助

  4. 01382140 于 2009-10-16 19:19:34发表:

    [i=s] 本帖最后由 01382140 于 2009-10-16 19:22 编辑 [/i]

    非常感谢版主的回复,因这几天工作较忙我会尽快操作并将结果反馈上来,希望能帮助到有需要的朋友。

  5. deepwhite 于 2009-10-16 12:18:18发表:

    [code]
    #! /bin/sh
    #
    # adsl Start/Stop ADSL link.
    #
    # chkconfig: 2345 15 85
    # description: ADSL connection start/stop script.
    # processname: pptp
    # config: /etc/adsl.conf
    # pidfile: /var/run/adsl.pid

    # ADSL connection parameters

    RETVAL=0

    start () {
    echo -n "Starting ADSL connection: "
    # Remove our special sign file and leftover socket sometimes left behind by pptp call manager
    rm -f /tmp/adsl.is.stopping /var/run/pptp/"${ADSL_IP}"
    # Bring up the pptp & ppp
    if /usr/local/sbin/pptp "${ADSL_IP}" user "$USER_NAME" remotename "${ADSL_IP} RELAY_PPP1" defaultroute noauth 2>/dev/null; then
    RETVAL=$?
    echo "ADSL went up successfully..."
    touch /var/lock/subsys/adsl
    else
    RETVAL=$?
    echo "ADSL didn't go up successfully..."
    fi
    # waitforconnect waits 2 minutes, and then tries to re-connect. It gets killed by ip-connect when the
    # link is properly brought up. This is a race condition here, in case ip-up is called BEFORE we get here,
    # but in reality I don't think it can happen that fast.
    $0 waitforconnect >/dev/null &
    echo
    }

    stop () {
    # this is a special sign for ip-down.local NOT to redial when the line is dropped.
    touch /tmp/adsl.is.stopping
    echo -n "Stopping ADSL connection: "
    killall -q -INT pppd
    killall -q -INT pptp
    sleep 5
    killall -q -INT pppd
    killall -q -INT pptp
    rm /var/run/pptp/${ADSL_IP}
    rm /var/run/ppp*
    RETVAL=$?
    echo
    [ $RETVAL -eq 0 ] && rm -f /var/lock/subsys/adsl
    }

    case "$1" in
    start)
    start
    ;;
    stop)
    stop
    # we kill ourselves here, but kill 'adsl waitforconnect' too!
    killall -q adsl
    ;;
    restart)
    stop
    start
    RETVAL=$?
    ;;
    waitforconnect)
    # Save our pid so /etc/ppp/ip-up.local will be able to kill us
    echo $ >/var/run/adsl-waitforconnect
    # We are going to re-try to reconnect every 2 minutes
    sleep 120
    stop
    start
    RETVAL=$?
    ;;
    *)
    echo "Usage: adsl {start|stop|restart}"
    exit 1
    ;;
    esac

    exit $RETVAL


    [/code]将其存为/etc/init.d/adsl, 并修改权限,然后,执行[code]chkconfig --add ads[/code]即可,注意我前面给出的帖子里面的连接里面有/etc/ppp/ip-up
    /etc/ppp/ip-down 这两个文件,如果你需要的话考下来放到自己的目录下。注意权限。

  6. 01382140 于 2009-10-16 08:48:06发表:

    怎么样才能把ADSL这个服务加入到系统服务里?

  7. hantu 于 2009-10-15 23:33:51发表:

    chkconfig 来用来配置系统服务的关与闭的,可是你的系统并没有adsl这个服务啊

  8. zhl1986628 于 2009-10-15 22:08:10发表:

    哦,你么会出现问题呢/

  9. 01382140 于 2009-10-15 20:57:46发表:

    [i=s] 本帖最后由 01382140 于 2009-10-15 21:14 编辑 [/i]

    看了一下,在我 的/etc/init.d/ 下面没有ADSL这个文件。版主发的键接都是英文看不懂呀

  10. deepwhite 于 2009-10-14 12:56:32发表:

    [i=s] 本帖最后由 deepwhite 于 2009-10-14 13:03 编辑 [/i]

    /etc/init.d/下面有没有adsl这个文件?
    chkconfig通过管理/etc/init.d/里面的文件来管理系统服务。我刚才看了一下,RHEL5里面装完你说的那个包后不会出现服务所需的文件,自己手动写一个吧或者去网上找一个别人写好的,然后放到/etc/init.d/下面,在执行你的命令就应该可以了。
    这里有些东西应该对你有用, 可以参考一下:
    http://mirror.hamakor.org.il/archives/linux-il/05-2004/9935.html

  11. 01382140 于 2009-10-14 10:44:19发表:

    就是,一直在等。难道这个问题真的很白痴?

  12. hktk125 于 2009-10-14 09:38:35发表:

    怎么都没人回复啊