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)
This article example shares the specific code of ...
Step 1: yum install httpd -y #Install httpd servi...
Table of contents Results at a Glance Heart Effec...
Let's take a look at the dynamic splicing of ...
For example, there is an input box <el-input r...
1. Brief introduction of the event An event is a ...
As shown below: #!/usr/bin/env python3.5 import p...
Currently, layui officials have not provided the ...
Join uses the Nested-Loop Join algorithm. There a...
Table of contents Using routing plugins in a modu...
Table of contents Introduction Mirror repository ...
This article describes how to use docker to deplo...
MySQL multi-table query Add a worksheet -- User t...
Transactional Characteristics 1. Atomicity: After...
This article records the installation tutorial of...