diff options
| author | Ben Sima <ben@bensima.com> | 2026-06-04 14:51:16 -0400 |
|---|---|---|
| committer | Ben Sima <ben@bensima.com> | 2026-06-04 14:51:16 -0400 |
| commit | 4fb839645f215bd33e0f5f131dd4cd3d65a94a3e (patch) | |
| tree | 6ba93ff19eefb006191ec4325e72c4b2f2ec3be6 /deploy.sh | |
| parent | ff34f98e3adf7899fb3857eabb80471ca51f8156 (diff) | |
Deploy slopbot as user service
Diffstat (limited to 'deploy.sh')
| -rwxr-xr-x | deploy.sh | 21 |
1 files changed, 12 insertions, 9 deletions
@@ -5,7 +5,8 @@ cd "$(dirname "$0")" SERVICE_NAME="slopbot" SERVICE_FILE="${SERVICE_NAME}.service" -SYSTEMD_SERVICE_PATH="/etc/systemd/system/${SERVICE_FILE}" +SYSTEMD_USER_DIR="${XDG_CONFIG_HOME:-$HOME/.config}/systemd/user" +SYSTEMD_SERVICE_PATH="${SYSTEMD_USER_DIR}/${SERVICE_FILE}" NIX=(nix --extra-experimental-features 'nix-command flakes') if [[ ! -f .zuliprc ]]; then @@ -35,18 +36,20 @@ echo "locking local flake inputs..." echo "building slopbot..." "${NIX[@]}" build .#slopbot -echo "installing systemd unit to ${SYSTEMD_SERVICE_PATH}..." -sudo install -m 0644 "${SERVICE_FILE}" "${SYSTEMD_SERVICE_PATH}" +echo "installing user systemd unit to ${SYSTEMD_SERVICE_PATH}..." +mkdir -p "${SYSTEMD_USER_DIR}" +install -m 0644 "${SERVICE_FILE}" "${SYSTEMD_SERVICE_PATH}" -echo "reloading systemd..." -sudo systemctl daemon-reload +echo "reloading user systemd..." +systemctl --user daemon-reload echo "enabling and restarting ${SERVICE_NAME}..." -sudo systemctl enable "${SERVICE_NAME}" -sudo systemctl restart "${SERVICE_NAME}" +systemctl --user enable "${SERVICE_NAME}" +systemctl --user restart "${SERVICE_NAME}" echo "${SERVICE_NAME} status:" -sudo systemctl --no-pager --full status "${SERVICE_NAME}" +systemctl --user --no-pager --full status "${SERVICE_NAME}" echo -echo "follow logs with: sudo journalctl -u ${SERVICE_NAME} -f" +echo "follow logs with: journalctl --user -u ${SERVICE_NAME} -f" +echo "to keep it running after logout, run once: sudo loginctl enable-linger $USER" |
