aboutsummaryrefslogtreecommitdiff
path: root/dotfiles/.local/bin/toggletorrent
blob: 4c67cc5f3488f9e892560165408b35947c36e7b6 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
#!/bin/sh

if ! [ -f "$HOME/.cache/transdaemonpid" ] ; then
	transmission-daemon
	TRANSPID=$!
	TRANSEXIT=$?
	if [ $TRANSEXIT -eq 0 ]; then
		pkill -RTMIN+10 waybar 
		echo "$TRANSPID" > ~/.cache/transdaemonpid
		exit
	fi
	notify-send " Torrent server" "Error while trying to start Transmission daemon"
	exit 1
fi

pkill -f "transmission-daemon"
rm ~/.cache/transdaemonpid
pkill -RTMIN+10 waybar