Improve logging, trap SIGALRM
This commit is contained in:
@@ -106,8 +106,10 @@ fsexec() {
|
|||||||
local file="$1"
|
local file="$1"
|
||||||
local filename="$(basename -- "$file")"
|
local filename="$(basename -- "$file")"
|
||||||
local logfile="$_optlogdir/$filename.log"
|
local logfile="$_optlogdir/$filename.log"
|
||||||
|
log "Inspecting configuration file: $filename" 2
|
||||||
if gettarget "$file"; then
|
if gettarget "$file"; then
|
||||||
# It's a defaults file with a selected target
|
# It's a defaults file with a selected target
|
||||||
|
log "File is an fsdefaults file" 2
|
||||||
target="$_return"
|
target="$_return"
|
||||||
log "Found target for $filename: \"$target\""
|
log "Found target for $filename: \"$target\""
|
||||||
[ -n "$_optdryrun" ] && return
|
[ -n "$_optdryrun" ] && return
|
||||||
@@ -118,6 +120,7 @@ fsexec() {
|
|||||||
bash -c "$target" > "$logfile" 2>&1 &
|
bash -c "$target" > "$logfile" 2>&1 &
|
||||||
elif [ $? = 50 ] && [ -x "$file" ]; then
|
elif [ $? = 50 ] && [ -x "$file" ]; then
|
||||||
# It's a shell script or executable symlink
|
# It's a shell script or executable symlink
|
||||||
|
log "File is an executable" 2
|
||||||
log "Executing file: \"$filename\""
|
log "Executing file: \"$filename\""
|
||||||
[ -n "$_optdryrun" ] && return
|
[ -n "$_optdryrun" ] && return
|
||||||
"$file" > "$logfile" 2>&1 &
|
"$file" > "$logfile" 2>&1 &
|
||||||
@@ -422,7 +425,8 @@ main() {
|
|||||||
if ! has basename; then
|
if ! has basename; then
|
||||||
error "Failed to find program: $_return" 1
|
error "Failed to find program: $_return" 1
|
||||||
fi
|
fi
|
||||||
|
# Fixes random SIGALRM bug
|
||||||
|
trap : SIGALRM
|
||||||
# Do the do
|
# Do the do
|
||||||
firestart
|
firestart
|
||||||
exit 0
|
exit 0
|
||||||
|
Reference in New Issue
Block a user