-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy patherror.liddle
More file actions
executable file
·67 lines (45 loc) · 1.83 KB
/
error.liddle
File metadata and controls
executable file
·67 lines (45 loc) · 1.83 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
#!/bin/bash
PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/root/scripts/working/Liddle
function errorExit {
# --------------------------------------------------
# Function for exit due to fatal error
# Requires 3 Arguments, CMD Number, Line number and error
# --------------------------------------------------
echo ""
echo "---------------------------------------------------"
echo " FATAL ERROR "
echo "---------------------------------------------------"
echo ""
echo "Script File: ${core[PROGNAME]}"
echo "Script Line: ${2}"
echo "Error: ${3:-"Unknown Error"}" 1>&2
# If the save file already exists we need to replace it
if [ -e "${core[DIR]}${core[PROGNAME]}.end" ]; then
echo ""
rm -f "${core[DIR]}${core[PROGNAME]}.end" || echo "Error could not replace prior save"
fi
# Only save progress if the script has actually started
if [ ${core[EXECUTION]} == "true" ]; then
# If the save file already exists we need to replace it
if [ -e "${core[DIR]}${core[PROGNAME]}.end" ]; then
echo ""
rm -f "${core[DIR]}${core[PROGNAME]}.end" || echo "Error could not replace prior save"
fi
save
# The script has not started yet so we don't need to save variables
else
echo ""
echo "Progress not saved"
echo "Script progress variables not yet set"
echo ""
fi
if [ ${core[LOGGING]} == "true" ]; then
echo "Ending Log ----------------------------------------"; endLog || echo "Failed to stop logging"
echo "Exiting..."
else
echo "Logging not running..."
echo "Exiting -------------------------------------------"
fi
echo ""
exit 1
}