25 lines
823 B
Desktop File
25 lines
823 B
Desktop File
# User-level systemd service to run main.py
|
|
# Uses a wrapper script so the working directory and .env are found correctly.
|
|
# Configuration is via ~/.config/libguides-notifier.env, no in-file path edits needed.
|
|
# Create that file with one line:
|
|
# REPO_PATH=/absolute/path/to/project
|
|
# Then run:
|
|
# systemctl --user daemon-reload
|
|
[Unit]
|
|
Description=Run main.py (LibGuides notifier)
|
|
OnFailure=notify-gitea-failure@%n.service
|
|
StartLimitBurst=5
|
|
StartLimitIntervalSec=43200
|
|
|
|
[Service]
|
|
Type=oneshot
|
|
Restart=on-failure
|
|
RestartSec=900
|
|
EnvironmentFile=%h/.config/libguides-notifier.env
|
|
ExecStartPre=/usr/bin/nm-online -q
|
|
ExecStartPre=/bin/bash -c 'for i in {1..600}; do getent hosts lgapi-us.libapps.com && exit 0; sleep 1; done; exit 1'
|
|
ExecStart=/bin/bash -lc '${REPO_PATH}/scripts/run_main.sh'
|
|
|
|
[Install]
|
|
WantedBy=default.target
|