These Solutions, the programmer will not be repeated labor.

Today, the major share of this chat, work that need to automate things, to be a little better ideas, see if you can catch your thoughts resonate.

In addition, whether you're in the door ape, ape still living in the door, you have to share today's look, maybe you can solve the urgent needs.

 

01. repetitive work (white)

 

Q: daily R & D process, have you addicted to it several steps?

 

Step one: synchronization update local project (SVN or Git)

Step two: local project compiler package demo-web.war

Step three: designated directory uploaded to the server, for example: XShell, SecureCRT (with significant cattle breaking Rz)

Step four: Restart Web application server, for example: Tomcat, Resin.

 

That indulge in more than the above operation, there is no looking over a wheel, to enhance your own development efficiency and free up more time to make coffee then?

 

640?wx_fmt=png

 

02. devote more time to make coffee (apes living in the door)

 

Some places have rivers and lakes all, repeat all contribute where we can abstract a wheel, it plainly is, you can steal lazy.

 

Out of the treasure chest in the development process, usually used automated deployment scripts auto_deploy.sh share a little, did not talk much, went straight to the code.

 

# Step 0: Program ape in the world are starting from 0, ready to work.

#!/bin/sh

projectName=demo_app

tomcatName=tomcat-7.0.90

tomcatPath=/app/tomcat/${tomcatName}

svnPath=/app/deploy/demo_app

targetProject=/target/demo_app-1.0/

 

# The first step: enter svn directory, and updated, and then maven compiler package

Which is followed by the # -P environmental information, if the project is to distinguish between development, testing, production configuration is different, it is necessary. Where the maven-related commands do not do in-depth analysis of this matter.

cd ${svnPath} && svn update && mvn clean install -P dev -Dmaven.test.skip=true

# Step two: enter tomcat directory, and stop the tomcat service

cd ${tomcatPath}/bin && ./shutdown.sh

kill -9 `ps -ef | grep ${tomcatName} | grep -v 'grep' | awk '{print $2}'`

 

# The third step: enter tomcat application deployment directory, delete the original project;

# Using rsync to synchronize all files except .svn folder to tomcat application deployment directory

cd ${tomcatPath}/webapps && rm -rf ./*

rsync --exclude=.svn -r ${svnPath}${targetProject} ${tomcatPath}/webapps/${projectName}

  

# Step Four: Start the tomcat application server.

cd ${tomcatPath}/bin && ./startup.sh

  

This, set SVN + Maven + Tomcat integration of automated publishing script is complete, other compilers, the deployment environment also thought the same, Zhaomaohuahu every minute Copy set.

 

The technology to build all the wheels are paper tigers. Sometimes, we found that the best way to break the paper tiger, than hands-on, you may wish to take a try, maybe will let you do more with less, taking more time to make coffee.

 

03. Data Report Automation (ape door Epiphany)

 

Tomorrow to open the product technology conference, Wang interface to access your statistics about the amount of concurrent peak and every day. They know everything that is to come up with real data out bragging rights.

 

General interview, I would often ask job seekers this question, see if there is relevant Solutions.

 

All roads lead to Rome ideas, and you only need to learn a trick, because a move in hand, the future worries. He said the following about to share my solution ideas.

 

Speaking briefly from well-log format. As the name suggests, a brief log prominent is the "brief." Generally only comprising: request a globally unique serial number, time of the request, the name of the interface, the processing time of the request, return code, return to the description.

 

For chestnuts, in-depth analysis.

 

Brief log format is as follows:

reqId, yyyyMMdd, hhmmss, function, time consuming process the request, return code, return information described

  

BRIEF SUMMARY shown log Li:

R2019061029823,20190610,102737, success UserQuery, 10ms, 0000, operating

  

A brief analysis of chestnut logs:

ID is a global request: R2019061029823 

request date: 20190610 

request time: 102,737 

request interfaces: UserQuery 

request is time-consuming: 10ms 

Request Return code is: 0000 

request returns as described: successful operation 

delimiter is: a comma (,)

  

Get a brief log data source, then the next step is to parse the data. In two days slightly code code to solve this problem is not a problem.

 

Like to use the Linux command line to get all (cat + cut + sort + uniq + head); like in Java, just to find a file IO tools, and then press OK to read, then follow the delimiter split, go beyond that, so easy; like to use python, come to burn incense panda pandas, every minute can solve the problem.

 

Get a brief split logs, then the split after a brief statistical data, matched with a glass of wine on the timing of the task, it can result in a good mood to see the applications running daily indicators friends.

 

This, the application data report automation problems solved friends.

 

04. take you install cattle X, take you fly (ape door sublimation)

 

Turning automated deployment, in addition to simple auto_deploy.sh mentioned in this article, you have to say about Java development is based on a continuous integration tools Jenkins, it is a collection of code compile, package, deploy platform web interface, if When conditions permit, try using it.

 

Turning to the application data automation, it may no longer sublimate it. Get a brief log data source, a brief analysis of log data, then if matched with a beautiful page, that does not matter packaged goods (ha ha), if a little promotion, it would mean that you could get it (low-key low-key).

 

05.  Message Written in the last

 

Or the phrase "denial of warm boiled frog, refused to blindly CRUD", if not usually encountered in the work repetitive work, then it may be a little thinking one or two, see if there is better technology wheels can be introduced, and could improve efficiency, then you can spend more time cup of coffee, taking more time to get busy some of their own things.

 

Codeword is not easy, the code allows you to understand at a glance the article more difficult. If you feel a little more interesting, a lot of attention, "say a small ape," for more exciting.

 

 

Guess you like

Origin www.cnblogs.com/socoool/p/12629800.html