Learning-"front-end"-Server script writing

Source: Internet
Author: User

When we deploy the server, we need to do a startup script to make it easy for us to start/Shut down the server.

Here I give a pro-test script file,

     The script is a script to start node, the principle is to start the execution of the start command, the resulting number is written to the file, and then stop the time to remove the PID from the file, and then kill it. Finally, the process is erased.

#! /bin/sh node_env=production daemon= "Node cluster.js" NAME= Fruitpoint desc=fruitpoint pidfile= "Fruitpoint.pid" case  "$"  in start)  echo  "starting $ desc:  "  nohup  $DAEMON  > /dev/null &  echo $! > $ Pidfile  echo  "$NAME.";; Stop)  echo  "stopping  $DESC: "    cat  $PIDFILE  |while read line ;  do  echo  $line  kill  $line  done   rm  $PIDFILE   echo   "$NAME.";; Esac exit 0 

Place the script file in the project root directory, start./file name start close./File name stop

Learning-"front-end"-Server script writing

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.