From d610225c84d0f7bc45d8d0b8afe8e337d5197d49 Mon Sep 17 00:00:00 2001 From: Viyurz Date: Wed, 21 Feb 2024 13:59:55 +0100 Subject: [PATCH] Zprofile ssh-agent fix for when no agent is running but .env file exists. --- .config/zsh/.zprofile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.config/zsh/.zprofile b/.config/zsh/.zprofile index 3159ade..c84f63a 100644 --- a/.config/zsh/.zprofile +++ b/.config/zsh/.zprofile @@ -1,5 +1,5 @@ # SSH Agent -if [[ ! -f "$XDG_RUNTIME_DIR/ssh-agent.env" ]]; then +if ! pgrep -u "$USER" ssh-agent > /dev/null || [[ ! -f "$XDG_RUNTIME_DIR/ssh-agent.env" ]]; then pkill -u "$USER" -9 ssh-agent ssh-agent > "$XDG_RUNTIME_DIR/ssh-agent.env" fi