various
parent
b358e5b924
commit
1b9994d09d
|
@ -128,7 +128,11 @@ function invoke_script() {
|
|||
exec 3>&1
|
||||
|
||||
script_error_log="$(create_tmp_file)"
|
||||
script_output=$("$backup_scripts_dir/$backup_script_filename" 2>$script_error_log 2>&1 | tee /dev/fd/3)
|
||||
script_output=$("$backup_scripts_dir/$backup_script_filename" 2>$script_error_log | tee /dev/fd/3)
|
||||
|
||||
if [[ -f "$script_error_log" ]]; then
|
||||
cat "$script_error_log"
|
||||
fi
|
||||
|
||||
if [[ "$?" == 0 ]]; then
|
||||
trigger_notify "success" "Backup script succeeded: $backup_script_name" "..."
|
||||
|
|
|
@ -8,7 +8,7 @@ function create_log() {
|
|||
content="$1"
|
||||
|
||||
log_dir="/var/log/zio"
|
||||
log_file="$(date +%Y%m%d%H%M%S).$(echo $RANDOM | md5sum | head -c 6; echo;).log"
|
||||
log_file="$(get_random_filename).log"
|
||||
|
||||
if [[ ! $(id -u) = 0 ]]; then
|
||||
log_dir="/tmp/zio/logs"
|
||||
|
@ -24,7 +24,11 @@ function create_log() {
|
|||
function create_tmp_file() {
|
||||
name="$1"
|
||||
prefix_dir="/tmp/zio"
|
||||
tmp_path="$prefix_dir/$(date +%s).$name"
|
||||
tmp_path="$prefix_dir/$(get_random_filename)"
|
||||
|
||||
if [[ "$name" != "" ]]; then
|
||||
tmp_path+=".$name"
|
||||
fi
|
||||
|
||||
mkdir -p "$prefix_dir"
|
||||
touch "$tmp_path"
|
||||
|
@ -59,6 +63,10 @@ function get_config_dir() {
|
|||
echo "$config_dir"
|
||||
}
|
||||
|
||||
function get_random_filename() {
|
||||
echo "$(date +%Y%m%d%H%M%S).$(echo $RANDOM | md5sum | head -c 6; echo;)"
|
||||
}
|
||||
|
||||
function get_real_path() {
|
||||
echo "$(cd -P "$1" && pwd)"
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue