In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-18 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)06/02 Report--
Today, I will talk to you about how to use scripts to automate daily operations in Java application development, which may not be well understood by many people. in order to make you understand better, the editor has summarized the following contents for you. I hope you can get something according to this article.
In daily development, I often encounter the following problems:
Check some operation information of a user (you don't need an interface, you just need to check the data according to fixed conditions, just take a look)
Need to install / deploy jar package to local warehouse / remote warehouse
A release maven project is required (that is, a new version of the project is released)
When testing, you often need to rebuild the database and data
Install the same maven project in different environments
Deploy and run the maven project
Backup database
Do data analysis according to system logs, such as active users, whether there is an abnormal IP, the operation history of an administrator, etc.
Monitor the server's running status and alarm
Clean up the junk files of the system
Compress logs and delete expired logs (for example, only store logs for the last 3 months)
Wait...
For some of the above operations because they are frequently used, we should use template + command / script automation instead of rewriting one at a time, that is:
Create a command file to store some frequently used commands (because some commands may only be used once a month, and you can't remember them), so that when you encounter them, you can copy them out and change the changeable place to run them directly. For example, the installation of the jar package in maven: mvn install:install-file-DgroupId=*-DartifactId=*-Dversion=*-Dpackaging=jar-Dfile=*.
For some operations that need to be performed step by step, you can use a batch file to store, and then next time you just need to execute the batch, and the variable part can be passed in using command-line parameters.
In fact, the idea of using the template is also used above, some constant but commonly used commands are centrally stored or scripted, and the next time you encounter the same problem, you only need to copy and execute the command or script, and the variable part is passed in through parameters.
For commands / scripts that need to be executed on a fixed cycle, you can use scheduled scheduling, such as linux's crontab scheduled scheduling, such as typical database backups, cleaning up junk files, compressing and deleting expired logs, and so on.
Many people may think that commands are slower than visual operations, which is so absolute that everything is relative, such as:
Commands on the command line, you can use the up and down arrows to find and execute, if it is executed repeatedly, it may be slow to enter the command, but what if you want to repeat it? Some friends will say, what if I use keyboard shortcuts? This is not discussed, only commands and visual window operations are discussed here)
For some tasks, such as maven web project, you need to: 1, download the code of *; 2, package; 3. Deploy to tomcat;4 and restart tomcat;. If you use automation scripts, you only need one sentence.
After reading the above, do you have any further understanding of how to automate daily operations with scripts in Java application development? If you want to know more knowledge or related content, please follow the industry information channel, thank you for your support.
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.