How to create a service and auto-start it in Ubuntu: 1. Create sandtable.service service in [/lib/systemd/system], [Unit] Description=/etc/sandtable Compatibility Documentation=man:systemd-sandtable-generator(8) ConditionFileIsExecutable=/etc/sandtable After=network.target [Service] Type=forking ExecStart=/etc/sandtable start TimeoutSec=0 RemainAfterExit=yes GuessMainPID=no [Install] WantedBy=multi-user.target Alias=sandtable.service 2. Create a startup script Create a sandtable startup script in the [/etc] folder. Remember to add [&] after the script to ensure that the service does not affect the system startup, otherwise it may cause the system to fail to start normally. #!/bin/sh /home/ubuntu/setup >> /home/ubuntu/test.log& 3. Start the service systemctl start sandtable.service #Start the servicesystemctl status sandtable.service #Check whether the service is startedsystemctl enable sandtable.service #Start the servicesystemctl is-enabled sandtable.service #Check whether the service is started 4 Common service commands systemctl is-enabled servicename.service #Query whether the service is started at boot systemctl enable *.service #Startup service systemctl disable *.service #Cancel startup systemctl start *.service #Start service systemctl stop *.service #Stop service systemctl restart *.service #Restart service systemctl reload *.service #Reload service configuration file systemctl status *.service #Query service running status 5. Open and close the desktop system // Shut down the desktop system sudo systemctl set-default multi-user.target sudo reboot // Open the desktop system sudo systemctl set-default graphical.target sudo reboot 6. The wifi settings of the desktop version can be modified and replaced in the following path /etc/NetworkManager/system-connections This is the end of this article about Ubuntu startup service settings. For more relevant Ubuntu startup content, please search 123WORDPRESS.COM's previous articles or continue to browse the following related articles. I hope everyone will support 123WORDPRESS.COM in the future! You may also be interested in:
|
>>: Pure CSS to achieve cool neon light effect (with demo)
Table of contents 1. Baidu Encyclopedia 1. MySQL ...
Jenkins configuration of user role permissions re...
WeChat applet's simple calculator is for your...
Customize a demo command The syntax of Vue custom...
yum quick install mysql Add yum repository rpm -U...
The warning points in this article have nothing t...
Say it in advance Nodejs reads the database as an...
The page length in the project is about 2000px or...
The differences among execute, executeUpdate, and...
This article uses an example to describe how to u...
one, G:\MySQL\MySQL Server 5.7\bin> mysqld --i...
Recently, when I was writing web pages with PHP, I...
In Linux system, newly install docker and enter t...
The CSS counter attribute is supported by almost ...
Judgment symbols are often used in MySQL, and not...