Created
April 27, 2017 12:41
-
-
Save sq3/c89dffbb4927c30e80ea7e602ab346e4 to your computer and use it in GitHub Desktop.
Auto-commit on inotify change triggerd by systemd.path
This file contains 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
#!/bin/bash | |
REPO_PATH=$1 | |
cd $REPO_PATH | |
git=$(which git) | |
git add -A && git commit -m "Scripted auto-commit on change triggerd by systemd.path" | |
git push -u origin master |
This file contains 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= Triggers the service that push network configs to gitlab changes. | |
Documentation= man:systemd.path | |
[Path] | |
PathModified=/usr/tftproot/config-backups | |
[Install] | |
WantedBy=multi-user.target |
This file contains 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=Pushs network config to gitlab | |
Documentation= man:systemd.service | |
[Service] | |
Type=oneshot | |
ExecStart=/usr/local/bin/autocommit.sh /usr/tftproot/config-backups |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment