+# Activate / Desactivate ASTROPORT 20h12.sh job & IPFS daemon

This commit is contained in:
fred 2022-10-28 02:59:48 +02:00
parent 8ab10b89e7
commit 3f33b1547c
1 changed files with 5 additions and 3 deletions

View File

@ -13,7 +13,7 @@ echo '
# qo-op # qo-op
############# '$MY_PATH/$ME' ############# '$MY_PATH/$ME'
######################################################################## ########################################################################
# Activate / Desactivate ASTROPORT 20h12.sh job # Activate / Desactivate ASTROPORT 20h12.sh job & IPFS daemon
########################################################################' ########################################################################'
# Clean # Clean
rm -f /tmp/mycron /tmp/newcron rm -f /tmp/mycron /tmp/newcron
@ -30,6 +30,7 @@ crontest=$(cat /tmp/mycron | grep -F '20h12.sh')
if [[ ! $crontest ]]; then if [[ ! $crontest ]]; then
## HEADER ## HEADER
[[ $1 == "OFF" ]] && exit 0
[[ ! $(cat /tmp/mycron | grep -F 'SHELL') ]] && echo "SHELL=/bin/bash" > /tmp/newcron [[ ! $(cat /tmp/mycron | grep -F 'SHELL') ]] && echo "SHELL=/bin/bash" > /tmp/newcron
[[ ! $(cat /tmp/mycron | grep -F 'PATH') ]] && echo "PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin" >> /tmp/newcron [[ ! $(cat /tmp/mycron | grep -F 'PATH') ]] && echo "PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin" >> /tmp/newcron
cat /tmp/mycron >> /tmp/newcron cat /tmp/mycron >> /tmp/newcron
@ -39,9 +40,10 @@ if [[ ! $crontest ]]; then
sudo systemctl enable ipfs sudo systemctl enable ipfs
sudo systemctl start ipfs sudo systemctl start ipfs
echo "ASTROPORT is ON" echo "ASTROPORT is ON"
[[ $1 == "ON" ]] && exit 0
else else
## HEADER ## HEADER
[[ $1 == "ON" ]] && exit 0
[[ ! $(cat /tmp/mycron | grep -F 'SHELL') ]] && echo "SHELL=/bin/bash" > /tmp/newcron [[ ! $(cat /tmp/mycron | grep -F 'SHELL') ]] && echo "SHELL=/bin/bash" > /tmp/newcron
[[ ! $(cat /tmp/mycron | grep -F 'PATH') ]] && echo "PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin" >> /tmp/newcron [[ ! $(cat /tmp/mycron | grep -F 'PATH') ]] && echo "PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin" >> /tmp/newcron
## REMOVE 20h12.sh line ## REMOVE 20h12.sh line
@ -50,7 +52,7 @@ else
sudo systemctl stop ipfs sudo systemctl stop ipfs
sudo systemctl disable ipfs sudo systemctl disable ipfs
echo "ASTROPORT is OFF" echo "ASTROPORT is OFF"
[[ $1 == "OFF" ]] && exit 0
fi fi