December 2018
Beginner
826 pages
22h 54m
English
We're going to again use Python's built-in web server, starting an instance using a small unit file.
First, create the directory in which we're going to store our unit file:
$ sudo mkdir -p /usr/local/lib/systemd/system
Next, we're going to echo the following into a file called pythonWebServer.service:
$ sudo tee /usr/local/lib/systemd/system/pythonWebServer.service << HERE[Unit]Description=Python Web Server Example[Service]ExecStart=/usr/bin/python2.7 -m SimpleHTTPServer[Install]WantedBy=multi-user.targetHERE
Now we can enable and start it:
$ sudo systemctl enable --now pythonWebServerCreated symlink from /etc/systemd/system/multi-user.target.wants/pythonWebServer.service ...
Read now
Unlock full access