david/synchole
david
/
synchole
Archived
1
0
Fork 0

fixed an issue with cron detection

This commit is contained in:
david 2019-11-09 02:59:24 +01:00
parent 00a7209d0f
commit b6425cd6da
1 changed files with 8 additions and 12 deletions

View File

@ -25,13 +25,6 @@ DEPENDENCIES="wget"
# **** functions ****
## check if script is run by cron
amicron() {
if [ -t 1 ]; then
return 1
fi
}
## check for elevated privileges
amiroot() {
if [ $(whoami) != "root" ]; then
@ -48,6 +41,13 @@ amipihole() {
## output handling
log() {
if [ -t 1 ]; then
CRON=0
else
CRON=1
fi
case $1 in
"error")
level="\033[31m✗\033[0m"
@ -162,11 +162,7 @@ log debug "Starting synchole"
## preflight checks
log debug "Running preflight checks"
if amicron; then
CRON=1
else
CRON=0
fi
if ! amiroot; then
log error "You must be root"