How to add an automatic startup program at boot through systemd in linux Ubuntu

This article describes how to create a web server in Linux system, and set up Systemd to automatically start and manage the operation of the web server.

Set up an Echo server

First write a simple echo server in Python and store it in /opt/echo_server.py :

 #!/usr/bin/env python3  import socket  # create socket serv = socket.socket(socket.AF_INET, socket.SOCK_STREAM)  # Bind the local 9000 connection port serv.bind(( ' 0.0.0.0 ' , 9000 ))  # Start accepting client connections serv.listen()  while True :      # Accept client connections

The post linux Ubuntu Adds an autostarter method on boot via systemd first appeared on Lenix Blog .

This article is reprinted from https://blog.p2hp.com/archives/8690
This site is for inclusion only, and the copyright belongs to the original author.

Leave a Comment