Skip to content

Instantly share code, notes, and snippets.

@ElijahLynn
Forked from funzoneq/simplehttp.service
Last active May 7, 2019 05:25
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ElijahLynn/ce1a103a6caa7dbd11f7facb3c943f8f to your computer and use it in GitHub Desktop.
Save ElijahLynn/ce1a103a6caa7dbd11f7facb3c943f8f to your computer and use it in GitHub Desktop.
A systemd file for a Python SimpleHTTPServer
# Upstream https://gist.github.com/ElijahLynn/ce1a103a6caa7dbd11f7facb3c943f8f
[Unit]
Description=Job that runs the Python SimpleHTTPServer daemon
Documentation=man:SimpleHTTPServer(1)
[Service]
Type=simple
WorkingDirectory=/tmp/backups
ExecStartPre=-/usr/bin/mkdir /tmp/backups
ExecStart=/usr/bin/python -m SimpleHTTPServer 80 &
ExecStop=/bin/kill `/bin/ps aux | /bin/grep SimpleHTTPServer | /bin/grep -v grep | /usr/bin/awk '{ print $2 }'`
[Install]
WantedBy=multi-user.target
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment