From 4288e0ebe57504be5294313ddb9dcbc17e82b821 Mon Sep 17 00:00:00 2001 From: Shahin Agha-Ghassem Date: Wed, 29 Mar 2023 21:57:20 +0200 Subject: [PATCH] Check if player pid exists --- iptv | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/iptv b/iptv index 3f20f15..f9d8ba1 100755 --- a/iptv +++ b/iptv @@ -91,10 +91,12 @@ selected_channel_name=$(echo "$selected_channel_line" | sed 's/\(.*\) url:.*/\1/ printf "Playing %s from %s" "$selected_channel_url" "$selected_channel_name" -player_pid=$(cat "$player_pid_file") +if [ -f "$player_pid_file" ]; then + player_pid=$(cat "$player_pid_file") -if kill -0 "$player_pid" >/dev/null 2>&1; then - kill "$player_pid" + if kill -0 "$player_pid" >/dev/null 2>&1; then + kill "$player_pid" + fi fi mpv "$selected_channel_url" > /dev/null 2>&1 &