mirror of
https://github.com/raspiblitz/raspiblitz.git
synced 2025-11-18 09:57:17 +01:00
screen fix
This commit is contained in:
@@ -21,12 +21,11 @@ if [ "$network" = "litecoin" ]; then
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
# screen background monitoring settings
|
# screen background monitoring settings
|
||||||
name="torrent"
|
name="Torrent"
|
||||||
targetDir="/mnt/hdd/torrent"
|
targetDir="/mnt/hdd/torrent"
|
||||||
targetSize=$size
|
targetSize=$size
|
||||||
maxTimeoutLoops=100000
|
maxTimeoutLoops=100000
|
||||||
#command="bash -c 'sudo lftp -c \"torrent -O ${targetDir} /home/admin/assets/${torrent}.torrent; bye\"'"
|
command="sudo lftp -c \"torrent -O ${targetDir} /home/admin/assets/${torrent}.torrent; bye\""
|
||||||
command="bash -c 'sudo ls'"
|
|
||||||
|
|
||||||
# starting session if needed
|
# starting session if needed
|
||||||
echo "checking if ${name} has a running screen session"
|
echo "checking if ${name} has a running screen session"
|
||||||
@@ -36,8 +35,9 @@ echo "isRunning(${isRunning})"
|
|||||||
if [ ${isRunning} -eq 0 ]; then
|
if [ ${isRunning} -eq 0 ]; then
|
||||||
echo "Starting screen session"
|
echo "Starting screen session"
|
||||||
sudo mkdir ${targetDir} 2>/dev/null
|
sudo mkdir ${targetDir} 2>/dev/null
|
||||||
echo "screen -S ${name} -dm ${command}"
|
screenCommand="screen -S ${name} -L screen.log -dm ${command}"
|
||||||
screen -S ${name} -dm ${command}
|
echo "${screenCommand}"
|
||||||
|
bash -c "${screenCommand}"
|
||||||
else
|
else
|
||||||
echo "Continue screen session"
|
echo "Continue screen session"
|
||||||
fi
|
fi
|
||||||
@@ -123,7 +123,7 @@ if [ ${isRunning} -eq 1 ]; then
|
|||||||
sessionPID=$(screen -ls | grep "${name}" | cut -d "." -f1 | xargs)
|
sessionPID=$(screen -ls | grep "${name}" | cut -d "." -f1 | xargs)
|
||||||
echo "killing screen session PID(${sessionPID})"
|
echo "killing screen session PID(${sessionPID})"
|
||||||
# kill all child processes of screen sceesion
|
# kill all child processes of screen sceesion
|
||||||
pkill -P ${sessionPID}
|
sudo pkill -P ${sessionPID}
|
||||||
echo "proccesses klilled"
|
echo "proccesses klilled"
|
||||||
sleep 3
|
sleep 3
|
||||||
# tell the screen session to quit and wait a bit
|
# tell the screen session to quit and wait a bit
|
||||||
|
|||||||
Reference in New Issue
Block a user