mirror of
https://github.com/namibia/demo-sync.git
synced 2024-11-22 03:25:09 +00:00
Updated the cronjob to be ignored if needed.
This commit is contained in:
parent
21e3811d9e
commit
fba123002f
17
sync.sh
17
sync.sh
@ -142,11 +142,11 @@ function echoTweak () {
|
|||||||
|
|
||||||
# Set cronjob without removing existing
|
# Set cronjob without removing existing
|
||||||
function setCron () {
|
function setCron () {
|
||||||
if [ -f "${CRONPATH}" ]; then
|
if [ ! -f "${CRONPATH}" ]; then
|
||||||
echoTweak "Crontab already configured for updates..."
|
echo ""
|
||||||
echo "Skipping"
|
echo -ne "\n Would you like set the cronjob now? [y/N]: "
|
||||||
else
|
read -r answer
|
||||||
echo "Adding crontab entry for continued updates..."
|
if [[ $answer == "y" ]]; then
|
||||||
# check if user crontab is set
|
# check if user crontab is set
|
||||||
currentCron=$(crontab -u $CLIENTUSER -l 2>/dev/null)
|
currentCron=$(crontab -u $CLIENTUSER -l 2>/dev/null)
|
||||||
if [[ -z "${currentCron// }" ]]; then
|
if [[ -z "${currentCron// }" ]]; then
|
||||||
@ -174,6 +174,13 @@ function setCron () {
|
|||||||
crontab -u $ACTIVEUSER "${CRONPATH}"
|
crontab -u $ACTIVEUSER "${CRONPATH}"
|
||||||
# close the block
|
# close the block
|
||||||
echo -e "\n ################################################################################################"
|
echo -e "\n ################################################################################################"
|
||||||
|
else
|
||||||
|
# to avoid asking again
|
||||||
|
echo "See ${CRONPATH} for more details!"
|
||||||
|
echo '# Do not remove this file!' > "${CRONPATH}"
|
||||||
|
echo '# Please set your cronjob manually, with the following details' >> "${CRONPATH}"
|
||||||
|
echo "# 0 4 * * * curl -s $SCRIPTURL | bash" >> "${CRONPATH}"
|
||||||
|
fi
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user