Linux custom scripts added to the rc.local script does not work correctly

Source: Internet
Author: User

In order to be able to surf the internet scientifically, you know. It is necessary to boot the service terminal. However, the script runs normally under the secure CRT and is added to/etc/rc.local but does not start the service properly. Using PS to find the next, the script is running, but the service is not up. So toss a pass, doubt is not the path can not find the reason. The export of the path, however, was duly completed.

Original script

#! /bin/SH#进程名字可修改PRO_NAME=Ssserverport=don't tell you pass=Don't tell you while true; Do#用ps获取 $PRO Number of _name processes NUM=`PSAux |grep${pro_name} |grep-Vgrep|WC-l ' #Echo "PS aux | grep ${pro_name} | grep-v grep |wc-l"  #Echo$NUM #小于1, restart the processif["${num}"-lt"1"]; Then    Echo "${pro_name} was killed"${pro_name}-P ${port}-K ${pass}-M aes- the-CFB--user Nobody-d startfi DoneExit0

The modified script

#! /bin/SH#进程名字可修改PRO_NAME=Ssserverport=want to tell you, pass?=I'm still not telling you. Export PATH="$PATH" while true; Do#用ps获取 $PRO Number of _name processes NUM=`PSAux |grep${pro_name} |grep-Vgrep|WC-l ' #Echo "PS aux | grep ${pro_name} | grep-v grep |wc-l"  #Echo$NUM #小于1, restart the processif["${num}"-lt"1"]; Then    Echo "${pro_name} was killed"${pro_name}-P ${port}-K ${pass}-M aes- the-CFB--user Nobody-d startfi DoneExit0

The internet goes on gracefully and scientifically, and the wall no longer.

Linux custom scripts added to the rc.local script does not work correctly

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.