Script to run the program with Jetty-runner.jar

Source: Internet
Author: User
Tags stdin

Today added a bit of script, feel very useful, happy ~

First clarify the characteristics of Linux/unix:

In general, each unix/Linux command will open three files when it runs: standard input file (stdin): stdin file descriptor for 0,unix program reads data from stdin by default.  Standard output file (stdout): StdOut file descriptor for 1,unix program outputs data to stdout by default. standard error file (stderr): The stderr file descriptor for the 2,unix program writes an error message to the stderr stream.

Sometimes, the program just start will brush the log to STD out (console), very annoying ~ today according to the above instructions, optimized the script.

Startup scripts
# !/bin/bashjava-xmx512m-xms64m-xx:permsize=256m-xx:maxpermsize=512m-jar jetty-runner.jar--port 12345 Server-0.0.1-snapshot.war  >/web/program/gw/logs/stdout.log 2>&1 &$! >/program.pid

Startup script Description:

1. Java-jar and some JVM parameters
2. Jetty-runner.jar parameters
3. directing standard output, standard error (1/2) from to/web/program/gw/logs/stdout.log
4. & Background Launch
5. Output the PID of the program to Program.pid

Close Script
# !/bin/bash - F ./program.pidrm. /program.pid

Closing the script is simply a pkill-f and then deleting the file.

Small experience
Java-xmx512m-xms64m-xx:permsize=256m-xx:maxpermsize=512m-jar Jetty-runner.jar--port 12345 Server-0.0.1-snapshot.war  >/web/program/gw/logs/stdout.log 2>&1 &

Previously there was no red part of the above. The problem is that after the system starts, the console is brushing the logs and God is bored. Add the red above, meaning that the standard output and standard error are output to this file.

Script to run the program with Jetty-runner.jar

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.