Why does Ubuntu rc. local fail to be executed ?!

Source: Internet
Author: User
Recently, I am working on a set of NMS, in which Ntop is used. I hope the server will automatically load Ntop every time it starts. So, according to the previous RHEL habits, in/etc/rc. add "ntop-iwlan0-d-L-untop & amp; & gt;/dev/null" to the local file, but after restarting, it is found that Ntop is not executed at all! Qijie @ sunshine :~ $ Psaux | grepntopqiji recently, I am working on a set of NMS, in which Ntop is used. I hope the server will automatically load Ntop each time it starts. So, according to the previous RHEL habits, in/etc/rc. "ntop-I wlan0-d-L-u ntop &>/dev/null" is added to the local file. However, after the local file is restarted, it is found that Ntop is not executed at all! Qijie @ sunshine :~ $ Ps aux | grep ntopqijie 2124 0.0 0.0 4012 752 pts/0 S + Grep -- color = auto ntop. So, google and Baidu started to encounter many problems, both of which said that the command line should be written before exit 0, and rc should also be said. "#! Remove-e from/bin/sh-e (it is said that the error of script execution can be ignored; otherwise, the script will stop executing), but it will not work! After N + times of Baidu, I finally found out the reasons and solutions for Ubuntu.
We can see from the following that the default Shell of Ubuntu is dash, not Bash! Root @ sunshine:/home/qijie # ls-al/bin/shlrwxrwxrwx 1 root 4 2010-10-03/bin/sh-> dashUbuntu The wiki provides official explanations. The main reason is that dash is smaller, runs faster, and is compatible with POSIX! However, the current problem is that the shell replacement causes many script errors. After all, many of the current scripts are not 100% POSIX compatible.
The solution is to change the default Shell to Bash: Method 1:  Run sudo dpkg-reconfigure dash on the terminal, and then select No (Recommend ); Method 2: Restart soft link Sudo rm/bin/sh Sudo ln-s/bin/bash/bin/sh After method 1 is adopted, Ntop can be automatically loaded. As follows: Root @ sunshine:/home/qijie # ps aux | grep ntopNtop 2493 0.5 1.5 127536 31580? Ssl 0: 02 ntop-I wlan0-d-L-u ntoproot 2738 0.0 0.0 4012 752 pts/0 S + 0: 00 grep -- color = auto ntop problem solved successfully!

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.