SHELL=/bin/bash

This commit is contained in:
qo-op 2021-02-16 12:29:39 +01:00
parent c3ac260137
commit 9d0b30b0ee
1 changed files with 8 additions and 3 deletions

View File

@ -19,13 +19,18 @@ echo '
# Get crontab
crontab -l > /tmp/mycron
# Remove any previous line containing "cron_MINUTE"
awk -i inplace -v rmv="cron_MINUTE" '!index($0,rmv)' /tmp/mycron && echo "Astroport cron was there"
awk -i inplace -v rmv="cron_MINUTE" '!index($0,rmv)' /tmp/mycron
# DOUBLE CHECK (awk = nawk or gawk -i ?)
crontest=$(cat /tmp/mycron | grep -F 'cron_MINUTE')
# ADD cron_MINUTE.sh TO cron ?
if [[ ! $crontest ]]; then
# NOT LOGGING TO FILE >> /tmp/astroport.log (TO MUCH DATA)
echo "* * * * * $MY_PATH/../cron_MINUTE.sh 2>&1>/dev/null" >> /tmp/mycron && crontab /tmp/mycron \
# NOT LOGGING TO FILE >> /tmp/astroport.log (TO MUCH DATA)
rm -f /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 >> /tmp/newcron
echo "* * * * * $MY_PATH/../cron_MINUTE.sh 2>&1>/dev/null" >> /tmp/newcron
crontab /tmp/newcron
else
echo "No operation needed. Your crontab is: " && crontab -l
fi