Services not recognized by linux

Source: Internet
Author: User

To add a service to linux:

1. Write a service script named testService.

Start () {echo "start testService"/usr/local/bin/testService & # executable file path exit 0;} stop () {echo-n "stop testService" if pkill testService then echo "[OK]" else echo "[failed]" fi} case "$1" instart) start; stop) stop; restart) stop start; *) echo "usage: $0 start | stop | restart" exit 0; esac

Second, copy the testService file to the/etc/init. d/directory.

Third, you can execute service testService start (stop, restart) to operate the file.


But today, we have a depressing opinion,

First, check whether the file exists in the/usr/init. d/directory.

Second, execute service testService start and report an error. The service is not recognized,

Third: Check whether the script file is correct. If it is true, it can be executed by other services.

Check the permissions of/usr/init. d/testServic, as follows:

[Root @ ~] # Service testService startuapd: unrecognized service [root @ ~] # Ll/etc/init. d/testService # Check permissions ---------- 1 root 1025 08-30/etc/init. d/testService # file permissions [root @ ~] # [Root @ ~] # Chmod 033/etc/init. d/testService # Set file permissions [root @ ~] # Service uapd startstart testService [OK] [root @ ~] #

Solution:

1. Check the permissions of the file. Even if the file is in the/etc/init. d/testService directory, the service is still unavailable.

2. After the File Permission is set, the service can recognize it normally.

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.