mirror of https://github.com/vvzvlad/vestasync
refactoting services and remove upload by timer
parent
fe07f2d180
commit
db872ae533
@ -1,9 +0,0 @@
|
||||
[Unit]
|
||||
Description=Pull git changes
|
||||
|
||||
[Service]
|
||||
Type=oneshot
|
||||
ExecStart=/usr/local/bin/pullgit.sh
|
||||
|
||||
[Install]
|
||||
WantedBy=multi-user.target
|
@ -1,6 +0,0 @@
|
||||
#!/usr/bin/env sh
|
||||
git config --global user.name vestasync_wb_$(hostname)
|
||||
git config --global user.email "vestasync@fake.mail"
|
||||
cd /mnt/data/etc/
|
||||
git fetch > /dev/null 2>&1 || true
|
||||
git pull > /dev/null 2>&1 || true
|
@ -1,10 +0,0 @@
|
||||
[Unit]
|
||||
Description=Run pullgit.service every 10 min
|
||||
|
||||
[Timer]
|
||||
OnCalendar=*:0/10
|
||||
Persistent=true
|
||||
Unit=pullgit.service
|
||||
|
||||
[Install]
|
||||
WantedBy=timers.target
|
@ -1,9 +0,0 @@
|
||||
[Unit]
|
||||
Description=Push git changes
|
||||
|
||||
[Service]
|
||||
Type=oneshot
|
||||
ExecStart=/usr/local/bin/pushgit.sh
|
||||
|
||||
[Install]
|
||||
WantedBy=multi-user.target
|
@ -1,11 +0,0 @@
|
||||
#!/usr/bin/env sh
|
||||
apt-mark showmanual > /mnt/data/etc/vestasync/packages
|
||||
echo $(hostname) > /mnt/data/etc/vestasync/hostname
|
||||
export GIT_AUTHOR_NAME="vestasync_wb_$(hostname)"
|
||||
export GIT_COMMITTER_NAME="vestasync_wb_$(hostname)"
|
||||
export LC_TIME=en_GB.UTF-8
|
||||
cd /mnt/data/etc/ > /dev/null 2>&1 || true
|
||||
git add . > /dev/null 2>&1 || true
|
||||
git commit -m "$(date +"%Y-%m-%d %H:%M:%S %z %Z")" > /dev/null 2>&1 || true
|
||||
git push -u origin master > /dev/null 2>&1 || true
|
||||
|
@ -1,10 +0,0 @@
|
||||
[Unit]
|
||||
Description=Run pushgit.service daily
|
||||
|
||||
[Timer]
|
||||
OnCalendar=daily
|
||||
Persistent=true
|
||||
Unit=pushgit.service
|
||||
|
||||
[Install]
|
||||
WantedBy=timers.target
|
@ -0,0 +1,7 @@
|
||||
#!/usr/bin/env bash
|
||||
apt-mark showmanual > /mnt/data/etc/vestasync/packages
|
||||
echo $(hostname) > /mnt/data/etc/vestasync/hostname
|
||||
cd /mnt/data/etc/
|
||||
git add .
|
||||
git commit -m "$(date +"%Y-%m-%d %H:%M:%S %z %Z")"
|
||||
git push -u origin master
|
@ -1,9 +1,9 @@
|
||||
[Unit]
|
||||
Description=Script triggered by file changes in a folder (including subfolders)
|
||||
Description=Main pushgit
|
||||
|
||||
[Service]
|
||||
Type=simple
|
||||
ExecStart=/usr/local/bin/pushgit_inotify.sh
|
||||
Restart=always
|
||||
|
||||
[Install]
|
||||
WantedBy=multi-user.target
|
@ -0,0 +1,12 @@
|
||||
#!/usr/bin/env bash
|
||||
export GIT_AUTHOR_NAME="vestasync_wb_$(hostname)"
|
||||
export GIT_COMMITTER_NAME="vestasync_wb_$(hostname)"
|
||||
export LC_TIME=en_GB.UTF-8
|
||||
EXCLUDE_PATTERN='(^|\/)(\.git|packages|hostname|wb-mqtt-mbgate\.conf|resolv\.conf)($|\/)'
|
||||
inotifywait -m -r -e close_write,move,create,delete --exclude "$EXCLUDE_PATTERN" --format '%w%f' /mnt/data/etc | while read FILE
|
||||
do
|
||||
/usr/local/bin/pushgit.sh
|
||||
done
|
||||
|
||||
|
||||
|
@ -0,0 +1,12 @@
|
||||
[Unit]
|
||||
Description=Script triggered by file changes in a folder (including subfolders)
|
||||
|
||||
[Service]
|
||||
ExecStartPre=systemctl stop pushgit_inotify.service
|
||||
ExecStart=systemctl start pushgit_inotify.service
|
||||
ExecStop=systemctl stop pushgit_inotify.service
|
||||
Type=oneshot
|
||||
RemainAfterExit=true
|
||||
|
||||
[Install]
|
||||
WantedBy=multi-user.target
|
@ -0,0 +1,9 @@
|
||||
[Unit]
|
||||
Description=Run pushgit.service on start
|
||||
|
||||
[Timer]
|
||||
OnBootSec=180
|
||||
Unit=pushgit_inotify_special.service
|
||||
|
||||
[Install]
|
||||
WantedBy=timers.target
|
@ -1,14 +0,0 @@
|
||||
#!/usr/bin/env bash
|
||||
EXCLUDE_PATTERN='(^|/)(\.git($|/)|wb-mqtt-mbgate\.conf$|resolv\.conf$)'
|
||||
|
||||
inotifywait -m -r -e close_write,move,create,delete --exclude "$EXCLUDE_PATTERN" --format '%w%f' /mnt/data/etc | while read FILE
|
||||
do
|
||||
echo $(hostname) > /mnt/data/etc/vestasync/hostname
|
||||
export GIT_AUTHOR_NAME="vestasync_wb_$(hostname)_inotify"
|
||||
export GIT_COMMITTER_NAME="vestasync_wb_$(hostname)_inotify"
|
||||
export LC_TIME=en_GB.UTF-8
|
||||
cd /mnt/data/etc/
|
||||
git add .
|
||||
git commit -m "$(date +"%Y-%m-%d %H:%M:%S %z %Z")" # > /dev/null 2>&1 || true
|
||||
git push -u origin master
|
||||
done
|
Loading…
Reference in New Issue