Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Example systemd file #604

Open
lfield opened this issue Oct 1, 2024 · 1 comment
Open

Example systemd file #604

lfield opened this issue Oct 1, 2024 · 1 comment

Comments

@lfield
Copy link

lfield commented Oct 1, 2024

Please could you add an example systemd file. Ideally this would also contain logging to a log file.

@Joker9944
Copy link

I built my own which seems to work fine. Just as a warning I'm not a systemd expert so the service might not be perfect.

[Install]
WantedBy=default.target

[Service]
ExecStart=/nix/store/h8rc4k0ix4q55r2qjjdlb71cg7xyg5p2-oidc-agent-5.2.3/bin/oidc-agent --console --quiet --log-stderr --socket-path "%t/oidc-agent.socket" --pid-file "%t/oidc-agent.pid"
ExecStopPost=/nix/store/k48bha2fjqzarg52picsdfwlqx75aqbb-coreutils-9.5/bin/rm "%t/oidc-agent.socket"
ExecStopPost=/nix/store/k48bha2fjqzarg52picsdfwlqx75aqbb-coreutils-9.5/bin/rm "%t/oidc-agent.pid"
PIDFile=%t/oidc-agent.pid
Restart=on-failure
Sockets=%t/oidc-agent.socket

[Unit]
After=network.target
Description=OIDC Agent Service - Manage OpenID Connect tokens
Documentation=https://indigo-dc.gitbook.io/oidc-agent
Wants=network-online.target

Also drop this somewhere in your .bashrc or other shell equivalent.

systemctl --user is-active --quiet oidc-agent.service && {
  export OIDC_SOCK="$XDG_RUNTIME_DIR/oidc-agent.socket"
  export OIDCD_PID="$(systemctl --user show --property MainPID --value oidc-agent.service)"
} || {
  unset OIDC_SOCK
  unset OIDCD_PID
}

Logs should be written to systemd and syslog.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants