mirror of
https://github.com/myvesta/vesta
synced 2025-08-14 10:37:42 -07:00
refactoring: log_event(), is_format_valid()
This commit is contained in:
parent
6e0ef668bb
commit
e05dca61a6
211 changed files with 756 additions and 1091 deletions
|
@ -30,7 +30,7 @@ source $VESTA/conf/vesta.conf
|
|||
#----------------------------------------------------------#
|
||||
|
||||
check_args '7' "$#" 'USER JOB MIN HOUR DAY MONTH WDAY COMMAND'
|
||||
validate_format 'user' 'job' 'min' 'hour' 'day' 'month' 'wday' 'command'
|
||||
is_format_valid 'user' 'job' 'min' 'hour' 'day' 'month' 'wday' 'command'
|
||||
is_system_enabled "$CRON_SYSTEM" 'CRON_SYSTEM'
|
||||
is_object_valid 'user' 'USER' "$user"
|
||||
is_object_unsuspended 'user' 'USER' "$user"
|
||||
|
@ -42,10 +42,15 @@ is_object_unsuspended 'cron' 'JOB' "$job"
|
|||
# Action #
|
||||
#----------------------------------------------------------#
|
||||
|
||||
# Generating timestamp
|
||||
time_n_date=$(date +'%T %F')
|
||||
time=$(echo "$time_n_date" |cut -f 1 -d \ )
|
||||
date=$(echo "$time_n_date" |cut -f 2 -d \ )
|
||||
|
||||
# Concatenating cron string
|
||||
command=$(echo $command | sed -e "s/'/%quote%/g")
|
||||
str="JOB='$job' MIN='$min' HOUR='$hour' DAY='$day' MONTH='$month' WDAY='$wday'"
|
||||
str="$str CMD='$command' SUSPENDED='no' TIME='$TIME' DATE='$DATE'"
|
||||
str="$str CMD='$command' SUSPENDED='no' TIME='$time' DATE='$date'"
|
||||
|
||||
# Deleting old job
|
||||
sed -i "/JOB='$job' /d" $USER_DATA/cron.conf
|
||||
|
@ -70,6 +75,6 @@ check_result $? "Cron restart failed" >/dev/null
|
|||
|
||||
# Logging
|
||||
log_history "changed cron job $job"
|
||||
log_event "$OK" "$EVENT"
|
||||
log_event "$OK" "$ARGUMENTS"
|
||||
|
||||
exit
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue