From 8db2ef98585c3962ecf2564f92351013cb30bdcd Mon Sep 17 00:00:00 2001 From: fred Date: Sun, 31 Oct 2021 21:30:13 +0100 Subject: [PATCH] ASTROPORT START if no ipfs daemon is running --- ajouter_video.sh | 7 +++++++ zen/cron_VRFY.sh | 4 ++++ 2 files changed, 11 insertions(+) diff --git a/ajouter_video.sh b/ajouter_video.sh index 05baddf..b618e70 100755 --- a/ajouter_video.sh +++ b/ajouter_video.sh @@ -87,6 +87,13 @@ case $? in esac fi +## CHECK IF ASTROPORT/CRON/IPFS IS RUNNING +YOU=$(ps auxf --sort=+utime | grep -w ipfs | grep -v -E 'color=auto|grep' | tail -n 1 | cut -d " " -f 1) +[[ ! $YOU ]] && RUN=$(zenity --entry --width 300 --title="Astroport/IPFS is OFF" --text="Activer Astroport ?" --entry-text="OUI" NON) +[[ $RUN == "" || $RUN == "NON" ]] && exit 1 +## ACTIVATION ASTROPORT +[[ $RUN == "OUI" ]] && REP=$(~/.zen/astrXbian/zen/cron_VRFY.sh) && zenity --warning --width 600 --text "$REP" + ######################################################################## # CHOOSE CATEGORY (remove anime, not working!) [[ $CHOICE == "" ]] && CHOICE=$(zenity --entry --width 300 --title="Catégorie" --text="Choisissez la catégorie de votre media" --entry-text="Film" Serie Youtube Video) diff --git a/zen/cron_VRFY.sh b/zen/cron_VRFY.sh index fe84265..0fb197e 100755 --- a/zen/cron_VRFY.sh +++ b/zen/cron_VRFY.sh @@ -34,6 +34,8 @@ if [[ ! $crontest ]]; then # ADD cron_MINUTE.sh line echo "* * * * * /bin/bash $MY_PATH/../cron_MINUTE.sh 2>&1>/dev/null" >> /tmp/newcron crontab /tmp/newcron + sudo systemctl enable ipfs + sudo systemctl start ipfs echo "ASTROPORT is ON" else ## HEADER @@ -42,6 +44,8 @@ else ## REMOVE cron_MINUTE.sh line cat /tmp/mycron | grep -Ev 'cron_MINUTE.sh' >> /tmp/newcron crontab /tmp/newcron + sudo systemctl stop ipfs + sudo systemctl disable ipfs echo "ASTROPORT is OFF" fi