Linux Shell Self-priming script notation

Source: Internet
Author: User

# **********************************************************************# Description of the Linux shell self-startup script #: # When we are doing the system, writing from the startup script is often the case, the following is a sample analysis. ##                                    .-1-TenShenzhen Nanshan Ping Shan Village Zengjianfeng #**********************************************************************#!/bin/SH# The script runs shell## sshd starts sshd. # description # # Then there are some conditions that need to be met before running the script, mainly to do some checking of the nature of the content, # to prevent subsequent programs from running, some environmental problems, or other follow-up procedures need to run the prerequisite for checking. # Make sure theSsh-keygenprogam exists[-f/usr/bin/Ssh-keygen] || Exit0# Create any missing keys/usr/bin/Ssh-keygen-a# If a file needs to be generated, some permissions want to be given by default, so that you don't have to give permission every time. Umask077# When the system starts, the function start () {printf"starting sshd:"/usr/sbin/sshdTouch/var/lock/sshdEcho "OK"}# When the system starts to stop, run the function stop () {printf"stopping sshd:"    KillallsshdRM-f/var/lock/sshdEcho "OK"}# function Restart () {Stop start}# is considered to be a branch call to the above three functions when the system starts to restart Case " $" inchstart) Start # Call the start function;;  STOP) Stop # calls the Stop function;; Restart|Reload) Restart # call restart function;; *)    Echo "Usage: $ {Start|stop|restart}"Exit1Esac# Exit and return execution result exit $?

Linux Shell Self-priming script notation

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.