linux the easiest way to start a program and run it automatically

  • 2021-07-09 09:35:08
  • OfStack

Collected many, all ended in failure, and finally found that this method is good, and does not affect the use, for the installation of xampp system, more important, I hope you agree. The method is as follows:

Create a new file in the/etc/init. d directory and set file permissions to run. Take any name. My name is xamppv. The content is as follows, especially the first few lines with #, which are indispensable and cannot be changed.


#!/bin/sh
### BEGIN INIT INFO
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
### END INIT INFO
PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin
sudo /opt/lampp/xampp start

Save the above files in the/etc/init. d directory and execute the following command. sudo systemctl enable xamppv, sudo systemctl start xamppv can start the program immediately. The following command can be used, and it doesn't matter if you don't use it. update-rc. d xampp defaults 400.

Setup is complete, restart the computer!

The above is the introduction of this linux let the program boot automatic running method and code content, thank you for your study and support for this site.


Related articles: