https://linuxhint.com/cron_systemd_timer/
cat /home/dk/.config/systemd/user/gdrive.org.service
[Unit]
Description=Upload org files to my google drive
# after networking is up on the server
After=network.target
[Service]
Type=simple
ExecStart=/usr/local/bin/gdrive sync upload --keep-local --delete-extraneous /home/dk/org <dir.id>
[Install]
WantedBy=multi-user.target
cat /home/dk/.config/systemd/user/gdrive.org.timer
# https://linuxhint.com/cron_systemd_timer/
[Unit]
Description=Schedule google drive backups every hour
[Timer]
OnCalendar=hourly
# RandomizedDelaySec=7200
Persistent=true
[Install]
WantedBy=timers.target
sudo apt install golang-go
go get github.com/prasmussen/gdrive
sudo install ~/go/bin/gdrive /usr/local/bin/gdrive
gdrive about
# Authentication needed
# Go to the following url in your browser:
# Enter verification code:
loginctl enable-linger dk
systemctl --user daemon-reload
systemctl --user enable gdrive.org.service
systemctl --user enable --now gdrive.org.timer
systemctl start svc # right now
systemctl stop svc
systemctl enable svc # e.g. on boot
systemctl disable svc
systemctl status svc
systemctl list-unit-files
https://community.chakralinux.org/t/how-to-investigate-systemd-errors/7024
systemctl --failed
journalctl _PID=<PID> # find by pid
journalctl -p err # find errors
journalctl -S today -f -u my.service # follow/tail since today
cat /home/dk/.config/systemd/user/q.service
[Unit]
Description=Keep q program running
# after networking is up on the server
After=network.target
StartLimitIntervalSec=30
StartLimitBurst=20
[Service]
Type=simple
WorkingDirectory=/home/dk
Environment=QLIC=/home/dk/conda/q QHOME=/home/dk/conda/q
ExecStart=/home/dk/conda/bin/q -p 7042
TimeoutSec=30s
Restart=always
RestartSec=15s
[Install]
WantedBy=multi-user.target
systemctl start q.service