Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ Terminal=true

File 2: wClock.sh
With the contents like this (script must be executable sh file):
Or please use the script in the main folder

```
cd /home/plotn/github/weatherClock/
Expand Down
27 changes: 27 additions & 0 deletions wClock.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
# Source taken from README.md by @plotn and modified a little bit.
#cd /home/plotn/github/weatherClock/

#Find the location of the python file from weatherClock.
cd /home/
dir_path=$(dirname $(find ./ -type f -name "weatherClock.py" | head -n 1))
echo $dir_path

#Detect python version
version=$(python -c 'import sys; print(".".join(map(str, sys.version_info[:2])))')
echo $version
if [[ -z "$version" ]]; then
echo "No Python detected!"
exit 2
fi

#Start the python script if it's not running.
while :
do
if test "$(ps aux | grep python3 | grep weather | wc -l)" -eq "0"
then
python$version $dir_path & disown
else
echo "already started"
fi
sleep 5
done