Linux Tips---Create shortcuts for each app

Source: Internet
Author: User

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

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.