fixed an issue with cron detection
This commit is contained in:
parent
00a7209d0f
commit
b6425cd6da
20
synchole.sh
20
synchole.sh
|
@ -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"
|
||||
|
|
Reference in New Issue