From fb15ba44c13dc158ffb1499d7a57622b56795fdd Mon Sep 17 00:00:00 2001 From: Ohad Livne Date: Wed, 4 Jun 2025 22:47:32 +0300 Subject: [PATCH] Periodically commit pending changes in all local projects --- .config/setup/03-install-cron-jobs.sh | 3 +++ .config/systemd/user/sync-git-repos.service | 10 ++++++++++ .config/systemd/user/sync-git-repos.timer | 10 ++++++++++ 3 files changed, 23 insertions(+) create mode 100644 .config/systemd/user/sync-git-repos.service create mode 100644 .config/systemd/user/sync-git-repos.timer diff --git a/.config/setup/03-install-cron-jobs.sh b/.config/setup/03-install-cron-jobs.sh index 5b29075..829ad9b 100755 --- a/.config/setup/03-install-cron-jobs.sh +++ b/.config/setup/03-install-cron-jobs.sh @@ -1,4 +1,7 @@ #! /usr/bin/sh +# keep-sorted start systemctl --user enable --now backup.timer systemctl --user enable --now sync-backup.timer +systemctl --user enable --now sync-git-repos.timer +# keep-sorted end diff --git a/.config/systemd/user/sync-git-repos.service b/.config/systemd/user/sync-git-repos.service new file mode 100644 index 0000000..248a645 --- /dev/null +++ b/.config/systemd/user/sync-git-repos.service @@ -0,0 +1,10 @@ +[Unit] +Description=Commit changes in local project repositories +Wants=sync-git-repos.timer + +[Service] +WorkingDirectory=%h +ExecStart=%h/.local/bin/sync-git-repos + +[Install] +WantedBy=default.target diff --git a/.config/systemd/user/sync-git-repos.timer b/.config/systemd/user/sync-git-repos.timer new file mode 100644 index 0000000..b395030 --- /dev/null +++ b/.config/systemd/user/sync-git-repos.timer @@ -0,0 +1,10 @@ +[Unit] +Description=Periodic repository commit +Requires=sync-git-repos.service + +[Timer] +Unit=sync-git-repos.service +OnCalendar=*:15,45 + +[Install] +WantedBy=timers.target