RPi Checkscript V1.0
Version vom 20. April 2024, 12:53 Uhr von Raz0rsedge (Diskussion | Beiträge) (Die Seite wurde neu angelegt: „<code> #!/usr/bin/bash #check if specific webserver script is running if pgrep -f webserver >/dev/null 2>&1; then #when running do noth…“)
- !/usr/bin/bash
- check if specific webserver script is running
if pgrep -f webserver >/dev/null 2>&1;
then
#when running do nothing but echo pid
echo "Script process id: " $(pgrep -f webserver) 2>&1
else
#if not running change dir
#and start script if exists
cd ~/sensor/Python/Raspberry_Pi
if ls webserver
then
python3 webserver &
else
echo "Script not found! Check name."
fi
#start script
fi