Adds Stats.app verifier
parent
92e669663b
commit
a8d668a755
@ -0,0 +1,29 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
# Define the processes to check
|
||||||
|
processes=(
|
||||||
|
"/Applications/Stats.app/Contents/MacOS/Stats"
|
||||||
|
"/Applications/Stats.app/Contents/PlugIns/WidgetsExtension.appex/Contents/MacOS/WidgetsExtension"
|
||||||
|
)
|
||||||
|
|
||||||
|
# Function to check if a process is running
|
||||||
|
check_process() {
|
||||||
|
local process=$1
|
||||||
|
pgrep -f "$process" >/dev/null
|
||||||
|
}
|
||||||
|
|
||||||
|
# Check each process and restart Stats.app if necessary
|
||||||
|
for process in "${processes[@]}"; do
|
||||||
|
if ! check_process "$process"; then
|
||||||
|
echo "Restarting Stats.app..."
|
||||||
|
open "/Applications/Stats.app"
|
||||||
|
|
||||||
|
# Wait for a short period to ensure the app starts (adjust as needed)
|
||||||
|
sleep 10
|
||||||
|
|
||||||
|
# Check again after waiting
|
||||||
|
if ! check_process "$process"; then
|
||||||
|
echo "Failed to restart Stats.app" | osascript -e 'tell application "Terminal" to do script "Failed to start Stats.app"'
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
done
|
Loading…
Reference in New Issue