Does Linux fail to run the script when it is switched on or off?
Source: Internet
Author: User
Does Linux fail to run the script when it is switched on or off? -- Linux general technology-Linux programming and kernel information. The following is a detailed description. Purpose: I want Red Hat to run the script testapp at startup and shutdown and print the corresponding information to a log file.
Environment:
1. testapp Creator: root
2. testapp path:/etc/init. d/testapp
3. Hard connection of testapp: ln/etc/init. d/testapp/etc/rc3.d/S91test
Ln/etc/init. d/testapp/etc/rc0.d/K91est
Chmod 744/etc/rc3.d/S91test
Chmod 744/etc/rc0.d/K91test
4. The content of testapp is as follows:
Case $1 in
'Start ')
Echo 'date' + % F % t' "system start">/var/log/test. log
;;
'Stop ')
Echo 'date' + % F % t' "system stop">/var/log/test. log
;;
Esac
Exit 0
Bytes ---------------------------------------------------------------------------------------------------
Under the root user, when testapp start or testapp stop is used, the corresponding information can be printed to the log file, but the testapp script is not run when the RedHat is switched on and off, and I do not know where the error is, please give me some advice. Thank you!
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