modern_lisp-machine/misc/scripts/mullvad.sh

24 lines
555 B
Bash
Raw Normal View History

2024-09-08 20:03:55 +00:00
EXEC_SHELL_PATH=$(command -v bash)
MULLVAD="/nix/var/nix/profiles/default/bin/mullvad-daemon"
LOG_FILE="/tmp/mullvad.log"
# Create the log directory if it doesn't exist
mkdir -p "$(dirname "$LOG_FILE")"
# Check if Navidrome is already running
if pgrep -x "mullvad" > /dev/null; then
echo "mullvad is already running. Exiting."
else
# Run Navidrome command, redirecting output to the log file and detaching it from the terminal
setsid nohup $MULLVAD > "$LOG_FILE" 2>&1 &
echo "mullvad started and detached from the terminal."
fi