In a hurry !!! Help write the script. Thank you !!!!

Source: Internet
Author: User
In a hurry !!! Help write the script. Thank you !!!! -- Linux general technology-Linux technology and application information. For details, refer to the following section. 1. Compile the htmon. sh script file to check the httpd service status.
(1) run the "service httpd status" command to test the httpd service status. If the returned value is 0, it indicates normal. If the returned value is non-o, it indicates abnormal.
(2) When the service status is abnormal, write log records to the ">" var/log/htmon. log "file through redirection.
(3) run the "service httpd restart" command to restart the httpd service and run the "service httpd status" command again to check the status of the httpd service.
(4) If the service is still abnormal, use the chkconfig command to set the httpd service to self-start, and then run the shutdown command to restart the system.
(5) Save the script after the test is completed to the file "/opt/htmon. sh", and the task of planning the disease settings is executed periodically. Monitoring tasks are performed every Monday to Friday every 15 minutes.
2. Compile the myuadd. sh script to add user accounts in batches.
(1) Use the read command to prompt the user to enter variable information such as the user quantity, user name prefix, expiration time, and initial password.
(2) Use the while statement to execute the Add USER command operation cyclically.
(3) use the if statement to determine the user number. The account smaller than 10 is automatically appended with the character "0" at the end of the prefix string ".
3. Compile the myudel. sh script to delete user accounts in batches.
(1) Use the first location parameter entered by the Administrator when executing the script as the username prefix (it is recommended that it be no shorter than 3 Characters and avoid overlap with other irrelevant users to avoid accidental deletion !)
(2) If the postmaster does not specify the location parameter, end the program after an error is prompted (you can use the "exit 1" statement. 1 indicates the status value of the shell environment returned after the script is released)
(3) Use the grep command. cut command to filter out the user account names with the specified prefix in the passwd file, and use the "-v" option to exclude the root user.
(4) Pay attention to "/etc/passwd" first ". "etc/shadow ". "etc/group" and other files are backed up to avoid accidental deletion of system users for recovery (check carefully before deleting users. OK !)
(5) execute the command to delete a user account cyclically using the for statement.
Please write down the details. Thank you !!

Write the "/etc/init. d/zebra" script file and add the "x" permission
(1) define the zebra service control statements that Start and Stop viewing status as functions respectively.
(2) run the "/usr/local/sbin/zebra-d" command to start the zebra service.
(3) Terminate the zebra service process by saving the pid number in the "/var/run/zebra. PID" file.
(4) determine the zebra service status by judging the "zebra-d" information in the current running process, for example, run the "ps aux | grep" zebra-d "| grep-v" grep "&>/dev/null" command first, and then determine the return status.
(5) set the case statement. When the script parameter ($1) provided by the user is "start", stop "," restart ", and" status ", the corresponding functions are called respectively, otherwise, execute the default operation and exit after the help information is displayed ....
I am a beginner. I like linux very much and hope to get your help!
Thank you .........
Related Article

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.