Booting or shutting down an app in Linux is sometimes troublesome, you have to CD to the app's executable script's directory to execute the script, and you can't turn the app on or off in any directory. Of course, setting the environment variable path can solve the problem of opening the application in any directory, but the startup or shutdown application script of each application is confusing in naming, for example, some called start-up.sh, it is difficult for users, especially the OPS personnel, to remember such a vague file name, and now I will soft connect + Configure environment variables to solve this problem.
For example, create a shortcut for Tomcat startup and shutdown so that Tomcat can be started or turned off in any directory.
1. Create a Shortcut Library folder
Mkdir/home/shortcut
2. Enter the Tomcat bin directory and create a soft connection
Enter the bin directory cd/home/runtime/apache-tomcat-8.5.31/bin//create a soft connection tomcat-startln-s/home/runtime/apache-tomcat-8.5.31/bin /startup.sh tomcat-start//Creating a soft connection tomcat-stopln-s/home/runtime/apache-tomcat-8.5.31/bin/shutdown.sh Tomcat-stop
3. Cut the created soft connection into the shortcut library
MV TOMCAT-START/HOME/SHORTCUTMV Tomcat-stop/home/shortcut
4. Configure the shortcut library to an environment variable
Vi/etc/profile
Open profile to add the following code
#SHORTCUT startexport path= $PATH:/home/shortcut#shortcut END
Save and exit and run source/etc/profile to make it effective immediately.
After this, we have successfully created a shortcut for Tomcat startup and shutdown and can be executed in any directory.
You'll need to add a shortcut to another app later simply create a soft connection for the app and put the soft connection in the/home/shortcut shortcut library to use.
Linux Tips---Create shortcuts for each app