Created
June 23, 2017 08:39
-
-
Save madblobfish/70a2515e6b8d57eb3ae1e299b6e6be73 to your computer and use it in GitHub Desktop.
Systemd service file to pull a git repositoy when recieveing tcp packets (webhook)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[Unit] | |
Description=Autopull through webhook | |
After=network.target | |
[Service] | |
User=<user> | |
Type=simple | |
Environment="GITPATH=%h/somegitfolder/" | |
Environment="PORT=9999" | |
Environment="LOGFILE=%h/.gitpull.log" | |
ExecStart=/bin/bash -xc 'echo -e "HTTP/1.1 204 No Content\\r\\nConnection: close\\r\\n\\r" | nc -l 0.0.0.0 -p ${PORT} | base64 | paste -d' ' <(date +%Y-%m-%dT%H:%M:%S) - >> ${LOGFILE}; cd ${GITPATH}; git pull' | |
Restart=always | |
StartLimitInterval=1min | |
StartLimitBurst=60 | |
[Install] | |
WantedBy=multi-user.target | |
# adapted from http://chrisberkhout.com/blog/simple-webhook/ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment