Compare commits
18 Commits
Author | SHA1 | Date | |
---|---|---|---|
e3caf0bba9 | |||
287cd741b4
|
|||
8b29105686 | |||
27c7367ef1
|
|||
f9cef4b70d | |||
e3a3e61bce
|
|||
bcec1f8f90 | |||
cf483de06b
|
|||
d9c9eda823 | |||
4737dbb60d
|
|||
f82249d10f | |||
d46ad2c2b4
|
|||
7911a7ed6f | |||
9853f854c9
|
|||
a2c8ff0f84 | |||
0ca8ed94cc
|
|||
227a0426b5 | |||
20d143035e
|
28
.gitea/workflows/sync-github.yml
Normal file
28
.gitea/workflows/sync-github.yml
Normal file
@@ -0,0 +1,28 @@
|
|||||||
|
name: Sync Release to GitHub
|
||||||
|
|
||||||
|
on:
|
||||||
|
workflow_dispatch:
|
||||||
|
inputs:
|
||||||
|
tag:
|
||||||
|
description: "Release tag to synchronize"
|
||||||
|
required: false
|
||||||
|
type: string
|
||||||
|
release:
|
||||||
|
types: [published, edited]
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
sync-github:
|
||||||
|
runs-on: ubuntu-22.04
|
||||||
|
|
||||||
|
steps:
|
||||||
|
- name: Run Releases Sync Action
|
||||||
|
uses: https://git.0xmax42.io/actions/releases-sync@main
|
||||||
|
with:
|
||||||
|
gitea_token: ${{ secrets.RELEASE_PUBLISH_TOKEN }}
|
||||||
|
gitea_url: https://git.0xmax42.io
|
||||||
|
gitea_owner: maxp
|
||||||
|
gitea_repo: systemd-timer
|
||||||
|
tag_name: ${{ inputs.tag || github.event.release.tag_name }}
|
||||||
|
github_token: ${{ secrets.SYNC_GITHUB_TOKEN }}
|
||||||
|
github_owner: 0xmax42
|
||||||
|
github_repo: systemd-timer
|
22
CHANGELOG.md
22
CHANGELOG.md
@@ -2,6 +2,28 @@
|
|||||||
|
|
||||||
All notable changes to this project will be documented in this file.
|
All notable changes to this project will be documented in this file.
|
||||||
|
|
||||||
|
## [0.2.3](https://git.0xmax42.io/maxp/systemd-timer/compare/v0.2.2..v0.2.3) - 2025-05-26
|
||||||
|
|
||||||
|
### 🚀 Features
|
||||||
|
|
||||||
|
- *(workflows)* Add GitHub release synchronization workflow - ([27c7367](https://git.0xmax42.io/maxp/systemd-timer/commit/27c7367ef1799428cc5a491b25036f77b65758af))
|
||||||
|
|
||||||
|
### 📚 Documentation
|
||||||
|
|
||||||
|
- *(readme)* Update project time badge interval - ([e3a3e61](https://git.0xmax42.io/maxp/systemd-timer/commit/e3a3e61bce0e62c2397bbc5bde3eff81b915c94a))
|
||||||
|
- Add Englisch README - ([cf483de](https://git.0xmax42.io/maxp/systemd-timer/commit/cf483de06b555599052b1d9f97ee98e9233e5a86))
|
||||||
|
|
||||||
|
## [0.2.2](https://git.0xmax42.io/maxp/systemd-timer/compare/v0.2.0..v0.2.2) - 2025-05-22
|
||||||
|
|
||||||
|
### 🐛 Bug Fixes
|
||||||
|
|
||||||
|
- *(install)* Enhance checksum validation with detailed comparison - ([0ca8ed9](https://git.0xmax42.io/maxp/systemd-timer/commit/0ca8ed94ccc4b9fe4ccac331957f01f852999094))
|
||||||
|
- *(install)* Ensure compatibility with non-bash shells - ([20d1430](https://git.0xmax42.io/maxp/systemd-timer/commit/20d143035ec6893f680b68dc4a2f6319ca7a5b81))
|
||||||
|
|
||||||
|
### 📚 Documentation
|
||||||
|
|
||||||
|
- *(readme)* Update installation instructions with script - ([9853f85](https://git.0xmax42.io/maxp/systemd-timer/commit/9853f854c991d87b12cd4fb5e19fce55e7246024))
|
||||||
|
|
||||||
## [0.2.0](https://git.0xmax42.io/maxp/systemd-timer/compare/v0.1.0..v0.2.0) - 2025-05-22
|
## [0.2.0](https://git.0xmax42.io/maxp/systemd-timer/compare/v0.1.0..v0.2.0) - 2025-05-22
|
||||||
|
|
||||||
### 🚀 Features
|
### 🚀 Features
|
||||||
|
103
README.DE.md
Normal file
103
README.DE.md
Normal file
@@ -0,0 +1,103 @@
|
|||||||
|
# systemd-timer
|
||||||
|
|
||||||
|

|
||||||
|
|
||||||
|
Ein einfaches CLI-Tool zum schnellen Erzeugen von systemd `.service` und `.timer` Units – als Ersatz oder moderne Ergänzung zu klassischen `cron`-Jobs.
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## 🚀 Features
|
||||||
|
|
||||||
|
- Erzeugt `.service` und `.timer` Dateien per CLI
|
||||||
|
- Unterstützt `--user` Timer (für `~/.config/systemd/user/`)
|
||||||
|
- Optionales Logging (`StandardOutput/StandardError`)
|
||||||
|
- Unterstützt:
|
||||||
|
- `--calendar`
|
||||||
|
- `--exec`
|
||||||
|
- `--after`
|
||||||
|
- `--environment`
|
||||||
|
- `--output`
|
||||||
|
- `--dry-run`
|
||||||
|
- Getestet und typisiert mit Deno + Cliffy
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## 🛠️ Installation
|
||||||
|
|
||||||
|
|
||||||
|
Du kannst `systemd-timer` direkt per Shell-Skript installieren:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
curl -fsSL https://git.0xmax42.io/maxp/systemd-timer/raw/branch/main/scripts/install.sh | sh
|
||||||
|
```
|
||||||
|
|
||||||
|
Das Skript erkennt automatisch deine Plattform (Linux `amd64` oder `arm64`) und installiert die passende Binary nach `/usr/local/bin`, sofern dies erlaubt ist (ggf. mit `sudo`).
|
||||||
|
|
||||||
|
**Hinweis:**
|
||||||
|
- Für die Installation ist eine funktionierende Internetverbindung notwendig.
|
||||||
|
- Die Integrität der Binary wird mittels SHA256-Prüfsumme verifiziert.
|
||||||
|
- Du kannst das Skript vor der Ausführung auch manuell inspizieren:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
curl -fsSL https://git.0xmax42.io/maxp/systemd-timer/raw/branch/main/scripts/install.sh -o install.sh
|
||||||
|
less install.sh
|
||||||
|
```
|
||||||
|
|
||||||
|
Weitere Optionen und manuelle Installationswege findest du unter [`scripts/install.sh`](scripts/install.sh).
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## 📦 Beispiel
|
||||||
|
|
||||||
|
```bash
|
||||||
|
./systemd-timer create \
|
||||||
|
--exec "/usr/local/bin/backup.sh" \
|
||||||
|
--calendar "Mon..Fri 02:00" \
|
||||||
|
--description "Backup Job" \
|
||||||
|
--user \
|
||||||
|
--logfile "/var/log/backup.log"
|
||||||
|
```
|
||||||
|
|
||||||
|
Erzeugt:
|
||||||
|
- `~/.config/systemd/user/backup.service`
|
||||||
|
- `~/.config/systemd/user/backup.timer`
|
||||||
|
|
||||||
|
Anschließend aktivieren:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
systemctl --user daemon-reload
|
||||||
|
systemctl --user enable --now backup.timer
|
||||||
|
```
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## 🧪 Tests ausführen
|
||||||
|
|
||||||
|
```bash
|
||||||
|
deno task test
|
||||||
|
```
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## 🧰 Entwickeln
|
||||||
|
|
||||||
|
```bash
|
||||||
|
deno task start create --exec "/bin/true" --calendar "daily" --dry-run
|
||||||
|
```
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## 🔒 Rechte / Flags
|
||||||
|
|
||||||
|
Das Tool benötigt beim Ausführen bzw. Kompilieren:
|
||||||
|
|
||||||
|
- `--allow-env` (für `$HOME`)
|
||||||
|
- `--allow-write` (zum Schreiben von `.service`/`.timer`)
|
||||||
|
|
||||||
|
Beim Entwickeln wird meist `-A` (allow all) verwendet.
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## 📝 Lizenz
|
||||||
|
|
||||||
|
[MIT License](LICENSE)
|
79
README.md
79
README.md
@@ -1,41 +1,55 @@
|
|||||||
# systemd-timer
|
# systemd-timer
|
||||||
|
|
||||||

|
- 
|
||||||
|
- [Deutsche Version dieser Readme](README.DE.md)
|
||||||
|
|
||||||
Ein einfaches CLI-Tool zum schnellen Erzeugen von systemd `.service` und `.timer` Units – als Ersatz oder moderne Ergänzung zu klassischen `cron`-Jobs.
|
A simple CLI tool for quickly generating systemd `.service` and `.timer` units — as a replacement or modern supplement to classic `cron` jobs.
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
## 🚀 Features
|
## 🚀 Features
|
||||||
|
|
||||||
- Erzeugt `.service` und `.timer` Dateien per CLI
|
* Generates `.service` and `.timer` files via CLI
|
||||||
- Unterstützt `--user` Timer (für `~/.config/systemd/user/`)
|
* Supports `--user` timers (for `~/.config/systemd/user/`)
|
||||||
- Optionales Logging (`StandardOutput/StandardError`)
|
* Optional logging (`StandardOutput/StandardError`)
|
||||||
- Unterstützt:
|
* Supports:
|
||||||
- `--calendar`
|
|
||||||
- `--exec`
|
* `--calendar`
|
||||||
- `--after`
|
* `--exec`
|
||||||
- `--environment`
|
* `--after`
|
||||||
- `--output`
|
* `--environment`
|
||||||
- `--dry-run`
|
* `--output`
|
||||||
- Getestet und typisiert mit Deno + Cliffy
|
* `--dry-run`
|
||||||
|
* Tested and typed with Deno + Cliffy
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
## 🛠️ Installation
|
## 🛠️ Installation
|
||||||
|
|
||||||
```bash
|
You can install `systemd-timer` directly via shell script:
|
||||||
git clone https://git.0xmax42.io/maxp/systemd-timer.git
|
|
||||||
cd systemd-timer
|
|
||||||
deno task build
|
|
||||||
|
|
||||||
# Binary liegt nun unter ./systemd-timer
|
```bash
|
||||||
./systemd-timer --help
|
curl -fsSL https://git.0xmax42.io/maxp/systemd-timer/raw/branch/main/scripts/install.sh | sh
|
||||||
```
|
```
|
||||||
|
|
||||||
|
The script automatically detects your platform (Linux `amd64` or `arm64`) and installs the appropriate binary to `/usr/local/bin`, if permitted (possibly using `sudo`).
|
||||||
|
|
||||||
|
**Note:**
|
||||||
|
|
||||||
|
* A working internet connection is required for installation.
|
||||||
|
* The integrity of the binary is verified using a SHA256 checksum.
|
||||||
|
* You can manually inspect the script before execution:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
curl -fsSL https://git.0xmax42.io/maxp/systemd-timer/raw/branch/main/scripts/install.sh -o install.sh
|
||||||
|
less install.sh
|
||||||
|
```
|
||||||
|
|
||||||
|
Additional options and manual installation methods are available under [`scripts/install.sh`](scripts/install.sh).
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
## 📦 Beispiel
|
## 📦 Example
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
./systemd-timer create \
|
./systemd-timer create \
|
||||||
@@ -46,11 +60,12 @@ deno task build
|
|||||||
--logfile "/var/log/backup.log"
|
--logfile "/var/log/backup.log"
|
||||||
```
|
```
|
||||||
|
|
||||||
Erzeugt:
|
This creates:
|
||||||
- `~/.config/systemd/user/backup.service`
|
|
||||||
- `~/.config/systemd/user/backup.timer`
|
|
||||||
|
|
||||||
Anschließend aktivieren:
|
* `~/.config/systemd/user/backup.service`
|
||||||
|
* `~/.config/systemd/user/backup.timer`
|
||||||
|
|
||||||
|
Activate afterwards:
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
systemctl --user daemon-reload
|
systemctl --user daemon-reload
|
||||||
@@ -59,7 +74,7 @@ systemctl --user enable --now backup.timer
|
|||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
## 🧪 Tests ausführen
|
## 🧪 Running Tests
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
deno task test
|
deno task test
|
||||||
@@ -67,7 +82,7 @@ deno task test
|
|||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
## 🧰 Entwickeln
|
## 🧰 Development
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
deno task start create --exec "/bin/true" --calendar "daily" --dry-run
|
deno task start create --exec "/bin/true" --calendar "daily" --dry-run
|
||||||
@@ -75,17 +90,17 @@ deno task start create --exec "/bin/true" --calendar "daily" --dry-run
|
|||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
## 🔒 Rechte / Flags
|
## 🔒 Permissions / Flags
|
||||||
|
|
||||||
Das Tool benötigt beim Ausführen bzw. Kompilieren:
|
The tool requires the following permissions when running or compiling:
|
||||||
|
|
||||||
- `--allow-env` (für `$HOME`)
|
* `--allow-env` (for `$HOME`)
|
||||||
- `--allow-write` (zum Schreiben von `.service`/`.timer`)
|
* `--allow-write` (to write `.service`/`.timer` files)
|
||||||
|
|
||||||
Beim Entwickeln wird meist `-A` (allow all) verwendet.
|
During development, usually `-A` (allow all) is used.
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
## 📝 Lizenz
|
## 📝 License
|
||||||
|
|
||||||
[MIT License](LICENSE)
|
[MIT License](LICENSE)
|
||||||
|
@@ -1,5 +1,11 @@
|
|||||||
#!/usr/bin/env bash
|
#!/usr/bin/env bash
|
||||||
set -euo pipefail
|
|
||||||
|
# Fail-safe bash mode (only if bash is used)
|
||||||
|
if [ -n "$BASH_VERSION" ]; then
|
||||||
|
set -euo pipefail
|
||||||
|
else
|
||||||
|
set -eu
|
||||||
|
fi
|
||||||
|
|
||||||
# === Konfiguration ===
|
# === Konfiguration ===
|
||||||
REPO_URL="https://git.0xmax42.io/maxp/systemd-timer/releases/download/latest"
|
REPO_URL="https://git.0xmax42.io/maxp/systemd-timer/releases/download/latest"
|
||||||
@@ -32,9 +38,18 @@ TMP_FILE=$(mktemp)
|
|||||||
curl -fsSL "${DOWNLOAD_URL}" -o "${TMP_FILE}"
|
curl -fsSL "${DOWNLOAD_URL}" -o "${TMP_FILE}"
|
||||||
chmod +x "${TMP_FILE}"
|
chmod +x "${TMP_FILE}"
|
||||||
|
|
||||||
# === Optional: SHA256-Check ===
|
# === SHA256-Check ===
|
||||||
curl -fsSL "${DOWNLOAD_URL}.sha256" -o "${TMP_FILE}.sha256"
|
TMP_HASH=$(mktemp)
|
||||||
echo "$(cat ${TMP_FILE}.sha256) ${TMP_FILE}" | sha256sum -c -
|
curl -fsSL "${DOWNLOAD_URL}.sha256" -o "$TMP_HASH"
|
||||||
|
EXPECTED_HASH=$(cut -d ' ' -f1 "$TMP_HASH")
|
||||||
|
ACTUAL_HASH=$(openssl dgst -sha256 "$TMP_FILE" | awk '{print $2}')
|
||||||
|
|
||||||
|
if [ "$EXPECTED_HASH" != "$ACTUAL_HASH" ]; then
|
||||||
|
echo "⚠️ Checksum mismatch!"
|
||||||
|
echo "Expected: $EXPECTED_HASH"
|
||||||
|
echo "Actual: $ACTUAL_HASH"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
# === Installation ===
|
# === Installation ===
|
||||||
echo "🚀 Installing to ${INSTALL_PATH}/${BINARY_NAME}"
|
echo "🚀 Installing to ${INSTALL_PATH}/${BINARY_NAME}"
|
||||||
|
Reference in New Issue
Block a user