Skip to content

Instantly share code, notes, and snippets.

@sq3
Created April 27, 2017 12:41
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save sq3/c89dffbb4927c30e80ea7e602ab346e4 to your computer and use it in GitHub Desktop.
Save sq3/c89dffbb4927c30e80ea7e602ab346e4 to your computer and use it in GitHub Desktop.
Auto-commit on inotify change triggerd by systemd.path
#!/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
[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
[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