actually, just use pidof

This commit is contained in:
Luke Smith 2020-04-13 11:49:40 -04:00
parent 3e88424b5d
commit d8f0865799
No known key found for this signature in database
GPG key ID: 4C50B54A911F6252
3 changed files with 6 additions and 7 deletions

View file

@ -4,8 +4,6 @@
killall -q polybar
# Wait until the processes have been shut down
while ps ax | grep -q "\spolybar$"; do sleep 1; done
while pidof polybar >/dev/null; do sleep 1; done
for i in $(polybar -m | awk -F: '{print $1}'); do MONITOR=$i polybar default & done
echo "Bars launched..."

View file

@ -1,11 +1,12 @@
#!/bin/sh
# If transmission-daemon is running, will ask to kill, else will ask to start.
if ps ax | grep -q "\stransmission-daemon$" ;
if pidof transmission-daemon >/dev/null ;
then
[ "$(printf "No\\nYes" | dmenu -i -p "Kill transmission-daemon?")" = "Yes" ] && killall transmission-da && notify-send "transmission-daemon killed."
[ "$(printf "No\\nYes" | dmenu -i -p "Turn off transmission-daemon?")" = "Yes" ] && killall transmission-da && notify-send "transmission-daemon disabled."
else
ifinstalled transmission-cli || exit
[ "$(printf "No\\nYes" | dmenu -i -p "Start transmission daemon?")" = "Yes" ] && transmission-daemon && notify-send "tranmission-daemon started."
[ "$(printf "No\\nYes" | dmenu -i -p "Turn on transmission daemon?")" = "Yes" ] && transmission-daemon && notify-send "tranmission-daemon enabled."
fi
sleep 3 && pkill -RTMIN+7 "${STATUSBAR:-dwmblocks}"

View file

@ -4,6 +4,6 @@
# transmission-daemon sometimes fails to take remote requests in its first moments, hence the sleep.
ps ax | grep -q "\stransmission-daemon$" || (transmission-daemon && notify-send "Starting transmission daemon..." && sleep 3 && pkill -RTMIN+7 "${STATUSBAR:-dwmblocks}") &
pidof transmission-daemon >/dev/null || (transmission-daemon && notify-send "Starting transmission daemon..." && sleep 3 && pkill -RTMIN+7 "${STATUSBAR:-dwmblocks}") &
transmission-remote -a "$@" && notify-send "🔽 Torrent added."