changed date format to %F

This commit is contained in:
Serghey Rodin 2011-11-28 14:45:03 +02:00
commit 8fe4b05a06
12 changed files with 75 additions and 179 deletions

View file

@ -83,8 +83,7 @@ v_str="$v_str U_DISK='0' SUSPEND='no' DATE='$V_DATE'"
echo "$v_str">>$V_USERS/$user/db.conf echo "$v_str">>$V_USERS/$user/db.conf
# Hiding password # Hiding password
dt="$(date +%m-%d-%y" "%H:%M:%S)" V_EVENT="$V_DATE $V_SCRIPT $user $database $db_user ***** $type $host"
V_EVENT="$dt $V_SCRIPT $user $database $db_user ***** $type $host"
# Logging # Logging
log_history "$V_EVENT" "v_del_db_base $user $database" log_history "$V_EVENT" "v_del_db_base $user $database"

View file

@ -11,7 +11,7 @@ domain=$(idn -t --quiet -u "$2" )
domain_idn=$(idn -t --quiet -a "$domain") domain_idn=$(idn -t --quiet -a "$domain")
ip=$3 ip=$3
template=${4-default} template=${4-default}
next_year=$(date +%m-%d-%y -d "+ 1 year") next_year=$(date +F -d "+ 1 year")
exp=${5-$next_year} exp=${5-$next_year}
soa=$6 soa=$6
ttl=${7-14400} ttl=${7-14400}

View file

@ -146,8 +146,7 @@ U_MAIL_DOMAINS='0'
DATE='$V_DATE'" > $V_USERS/$user/user.conf DATE='$V_DATE'" > $V_USERS/$user/user.conf
# Hiding password # Hiding password
dt="$(date +%m-%d-%y" "%H:%M:%S)" V_EVENT="$V_DATE $V_SCRIPT $user ***** $email $package $fname $lname"
V_EVENT="$dt $V_SCRIPT $user ***** $email $package $fname $lname"
# Logging # Logging
log_event 'system' "$V_EVENT" log_event 'system' "$V_EVENT"

View file

@ -91,7 +91,7 @@ fi
update_web_domain_value '$STATS_AUTH' "$a_users" update_web_domain_value '$STATS_AUTH' "$a_users"
# Hiding password # Hiding password
V_EVENT="$(date +%m-%d-%y" "%H:%M:%S) $V_SCRIPT $user $domain $auth_user *****" V_EVENT="$V_DATE $V_SCRIPT $user $domain $auth_user *****"
# Logging # Logging
log_history "$V_EVENT" "v_del_web_domain_stat_auth $user $domain $auth_user" log_history "$V_EVENT" "v_del_web_domain_stat_auth $user $domain $auth_user"

View file

@ -7,7 +7,6 @@
# Argument defenition # Argument defenition
user=$1 user=$1
output=$2
# Importing variables # Importing variables
source $VESTA/conf/vars.conf source $VESTA/conf/vars.conf
@ -22,7 +21,7 @@ source $V_FUNC/db.func
#----------------------------------------------------------# #----------------------------------------------------------#
# Checking arg number # Checking arg number
check_args '1' "$#" 'user [output]' check_args '1' "$#" 'user'
# Checking argument format # Checking argument format
format_validation 'user' format_validation 'user'
@ -40,10 +39,8 @@ is_backup_enabled
la=$(cat /proc/loadavg |cut -f 1 -d ' '|cut -f 1 -d '.') la=$(cat /proc/loadavg |cut -f 1 -d ' '|cut -f 1 -d '.')
i=0 i=0
while [ "$la" -ge "$V_BACKUP_LA_LIMIT" ]; do while [ "$la" -ge "$V_BACKUP_LA_LIMIT" ]; do
if [ -z "$output" ]; then echo "$(date "+%F %T") Load Average $la"
echo "$(date +%m-%d-%y" "%H:%M:%S) Load Average $la" echo
echo
fi
sleep 60 sleep 60
@ -65,14 +62,12 @@ done
start_time=$(date '+%s') start_time=$(date '+%s')
# Creating temporary random directory # Creating temporary random directory
tmpdir=$(mktemp -p $V_TMP -d) tmpdir=$(mktemp -p $V_BACKUP -d)
# Prinitng status # Prinitng status
if [ -z "$output" ]; then echo "$(date "+%F %T") System backup for user $user"
echo "$(date +%m-%d-%y" "%H:%M:%S) System backup for user $user" echo "TMPDIR is $tmpdir"
echo "TMPDIR is $tmpdir" echo
echo
fi
# Addding backup and vesta version # Addding backup and vesta version
echo "1.0" > $tmpdir/backup_version echo "1.0" > $tmpdir/backup_version
@ -81,127 +76,87 @@ echo "$VERSION" > $tmpdir/vesta_version
# Vesta # Vesta
if [ -z "$output" ]; then echo "-- VESTA --"
echo "-- VESTA --"
fi
vst='yes' vst='yes'
mkdir $tmpdir/vesta mkdir $tmpdir/vesta
# Backingup vesta configs # Backingup vesta configs
if [ -z "$output" ]; then echo -e "$(date "+%F %T") user.conf"
echo -e "\t$(date +%H:%M:%S) user.conf"
fi
cp -r $V_USERS/$user/user.conf $tmpdir/vesta/ cp -r $V_USERS/$user/user.conf $tmpdir/vesta/
if [ -e "$V_USERS/$user/billing.log" ]; then if [ -e "$V_USERS/$user/billing.log" ]; then
if [ -z "$output" ]; then echo -e "$(date "+%F %T") billing.log"
echo -e "\t$(date +%H:%M:%S) billing.log"
fi
cp -r $V_USERS/$user/billing.log $tmpdir/vesta/ cp -r $V_USERS/$user/billing.log $tmpdir/vesta/
fi fi
if [ -e "$V_USERS/$user/history.log" ]; then if [ -e "$V_USERS/$user/history.log" ]; then
if [ -z "$output" ]; then echo -e "$(date "+%F %T") history.log"
echo -e "\t$(date +%H:%M:%S) history.log"
fi
cp -r $V_USERS/$user/history.log $tmpdir/vesta/ cp -r $V_USERS/$user/history.log $tmpdir/vesta/
fi fi
if [ -e "$V_USERS/$user/backup.excludes" ]; then if [ -e "$V_USERS/$user/backup.excludes" ]; then
if [ -z "$output" ]; then echo -e "$(date "+%F %T") backup.excludes"
echo -e "\t$(date +%H:%M:%S) backup.excludes"
fi
cp -r $V_USERS/$user/backup.excludes $tmpdir/vesta/ cp -r $V_USERS/$user/backup.excludes $tmpdir/vesta/
fi fi
if [ -e "$V_USERS/$user/cron.conf" ]; then if [ -e "$V_USERS/$user/cron.conf" ]; then
if [ -z "$output" ]; then echo -e "$(date "+%F %T") cron.conf"
echo -e "\t$(date +%H:%M:%S) cron.conf"
fi
cp -r $V_USERS/$user/cron.conf $tmpdir/vesta/ cp -r $V_USERS/$user/cron.conf $tmpdir/vesta/
fi fi
if [ -e "$V_USERS/$user/db.conf" ]; then if [ -e "$V_USERS/$user/db.conf" ]; then
if [ -z "$output" ]; then echo -e "$(date "+%F %T") db.conf"
echo -e "\t$(date +%H:%M:%S) db.conf"
fi
cp -r $V_USERS/$user/db.conf $tmpdir/vesta/ cp -r $V_USERS/$user/db.conf $tmpdir/vesta/
fi fi
if [ -e "$V_USERS/$user/dns.conf" ]; then if [ -e "$V_USERS/$user/dns.conf" ]; then
if [ -z "$output" ]; then echo -e "$(date "+%F %T") dns.conf"
echo -e "\t$(date +%H:%M:%S) dns.conf"
fi
cp -r $V_USERS/$user/dns.conf $tmpdir/vesta/ cp -r $V_USERS/$user/dns.conf $tmpdir/vesta/
fi fi
if [ -e "$V_USERS/$user/mail.conf" ]; then if [ -e "$V_USERS/$user/mail.conf" ]; then
if [ -z "$output" ]; then echo -e "$(date "+%F %T") mail.conf"
echo -e "\t$(date +%H:%M:%S) mail.conf"
fi
cp -r $V_USERS/$user/mail.conf $tmpdir/vesta/ cp -r $V_USERS/$user/mail.conf $tmpdir/vesta/
fi fi
if [ -e "$V_USERS/$user/web.conf" ]; then if [ -e "$V_USERS/$user/web.conf" ]; then
if [ -z "$output" ]; then echo -e "$(date "+%F %T") web.conf"
echo -e "\t$(date +%H:%M:%S) web.conf"
fi
cp -r $V_USERS/$user/web.conf $tmpdir/vesta/ cp -r $V_USERS/$user/web.conf $tmpdir/vesta/
fi fi
echo
if [ -z "$output" ]; then
echo
fi
# PAM # PAM
if [ -z "$output" ]; then echo "-- PAM --"
echo "-- PAM --"
fi
pam='yes' pam='yes'
mkdir $tmpdir/pam mkdir $tmpdir/pam
if [ -z "$output" ]; then echo -e "$(date "+%F %T") passwd / shadow /group"
echo -e "\t$(date +%H:%M:%S) passwd / shadow /group"
fi
grep "^$user:" /etc/passwd > $tmpdir/pam/passwd grep "^$user:" /etc/passwd > $tmpdir/pam/passwd
grep "^$user:" /etc/shadow > $tmpdir/pam/shadow grep "^$user:" /etc/shadow > $tmpdir/pam/shadow
grep "^$user:" /etc/group > $tmpdir/pam/group grep "^$user:" /etc/group > $tmpdir/pam/group
echo
if [ -z "$output" ]; then
echo
fi
# Checking excludes # Checking excludes
OLD_IFS="$IFS" OLD_IFS="$IFS"
IFS=$'\n' IFS=$'\n'
if [ -e "$V_USERS/$user/backup.excludes" ]; then if [ -e "$V_USERS/$user/backup.excludes" ]; then
if [ -z "$output" ]; then echo "-- Excludes --"
echo "-- Excludes --"
fi
for exclude in $(cat $V_USERS/$user/backup.excludes); do for exclude in $(cat $V_USERS/$user/backup.excludes); do
if [ -z "$output" ]; then echo -e "$exclude"
echo -e "\t$exclude"
fi
# Indirect variable references (a bit of black magic) # Indirect variable references (a bit of black magic)
eval ${exclude%%=*}=${exclude#*=} eval ${exclude%%=*}=${exclude#*=}
done done
echo
if [ -z "$output" ]; then
echo
fi
fi fi
IFS="$OLD_IFS" IFS="$OLD_IFS"
# WEB domains # WEB domains
if [ ! -z "$WEB_SYSTEM" ] && [ "$WEB_SYSTEM" != 'no' ] && [ "$WEB" != '*' ] if [ ! -z "$WEB_SYSTEM" ] && [ "$WEB_SYSTEM" != 'no' ] && [ "$WEB" != '*' ]
then then
if [ -z "$output" ]; then echo "-- WEB --"
echo "-- WEB --"
fi
mkdir $tmpdir/web/ mkdir $tmpdir/web/
# Parsing unsuspeneded domains # Parsing unsuspeneded domains
@ -221,10 +176,7 @@ then
web_list=$(echo "$web_list" | sed -e "s/ */\ /g" -e "s/^ //") web_list=$(echo "$web_list" | sed -e "s/ */\ /g" -e "s/^ //")
for domain in $web_list; do for domain in $web_list; do
if [ -z "$output" ]; then echo -e "$(date "+%F %T") $domain"
echo -e "\t$(date +%H:%M:%S) $domain"
fi
# Building directory tree # Building directory tree
mkdir -p $tmpdir/web/$domain/conf mkdir -p $tmpdir/web/$domain/conf
mkdir -p $tmpdir/web/$domain/ssl mkdir -p $tmpdir/web/$domain/ssl
@ -296,18 +248,13 @@ then
fi fi
done done
if [ -z "$output" ]; then echo
echo
fi
fi fi
# DNS domains # DNS domains
if [ ! -z "$DNS_SYSTEM" ] && [ "$DNS_SYSTEM" != 'no' ] && [ "$DNS" != '*' ] if [ ! -z "$DNS_SYSTEM" ] && [ "$DNS_SYSTEM" != 'no' ] && [ "$DNS" != '*' ]
then then
if [ -z "$output" ]; then echo "-- DNS --"
echo "-- DNS --"
fi
mkdir $tmpdir/dns/ mkdir $tmpdir/dns/
# Parsing unsuspeneded domains # Parsing unsuspeneded domains
@ -326,10 +273,7 @@ then
dns_list=$(echo "$dns_list" | sed -e "s/ */\ /g" -e "s/^ //") dns_list=$(echo "$dns_list" | sed -e "s/ */\ /g" -e "s/^ //")
for domain in $dns_list; do for domain in $dns_list; do
if [ -z "$output" ]; then echo -e "$(date "+%F %T") $domain"
echo -e "\t$(date +%H:%M:%S) $domain"
fi
# Building directory tree # Building directory tree
mkdir $tmpdir/dns/$domain mkdir $tmpdir/dns/$domain
@ -342,10 +286,7 @@ then
cp $V_USERS/$user/dns/$domain $domain cp $V_USERS/$user/dns/$domain $domain
cp /etc/namedb/$domain.db $domain.db cp /etc/namedb/$domain.db $domain.db
done done
echo
if [ -z "$output" ]; then
echo
fi
fi fi
@ -354,9 +295,7 @@ fi
# DatbaBases # DatbaBases
if [ ! -z "$DB_SYSTEM" ] && [ "$DB_SYSTEM" != 'no' ] && [ "$DB" != '*' ]; then if [ ! -z "$DB_SYSTEM" ] && [ "$DB_SYSTEM" != 'no' ] && [ "$DB" != '*' ]; then
if [ -z "$output" ]; then echo "-- DB --"
echo "-- DB --"
fi
mkdir $tmpdir/db/ mkdir $tmpdir/db/
# Parsing unsuspeneded domains # Parsing unsuspeneded domains
@ -381,9 +320,7 @@ if [ ! -z "$DB_SYSTEM" ] && [ "$DB_SYSTEM" != 'no' ] && [ "$DB" != '*' ]; then
dump="$tmpdir/db/$database.$type.sql" dump="$tmpdir/db/$database.$type.sql"
grants="$tmpdir/db/$database.$type.$db_user" grants="$tmpdir/db/$database.$type.$db_user"
if [ -z "$output" ]; then echo -e "$(date "+%F %T") $database $type"
echo -e "\t$(date +%H:%M:%S) $database $type"
fi
case $type in case $type in
mysql) dump_db_mysql ;; mysql) dump_db_mysql ;;
@ -395,46 +332,30 @@ if [ ! -z "$DB_SYSTEM" ] && [ "$DB_SYSTEM" != 'no' ] && [ "$DB" != '*' ]; then
fi fi
done done
echo
if [ -z "$output" ]; then
echo
fi
fi fi
# Cron jobs # Cron jobs
if [ ! -z "$CRON_SYSTEM" ] && [ "$CRON_SYSTEM" != 'no' ] && [ "$CRON" != '*' ] if [ ! -z "$CRON_SYSTEM" ] && [ "$CRON_SYSTEM" != 'no' ] && [ "$CRON" != '*' ]
then then
if [ -z "$output" ]; then echo "-- CRON --"
echo "-- CRON --"
fi
mkdir $tmpdir/cron/ mkdir $tmpdir/cron/
# Backingup cron recods # Backingup cron recods
if [ -z "$output" ]; then echo -e "$(date "+%F %T") cron.conf"
echo -e "\t$(date +%H:%M:%S) cron.conf"
fi
cp $V_USERS/$user/cron.conf $tmpdir/cron/ cp $V_USERS/$user/cron.conf $tmpdir/cron/
echo -e "$(date "+%F %T") system cron"
if [ -z "$output" ]; then
echo -e "\t$(date +%H:%M:%S) system cron"
fi
if [ -e "/var/spool/cron/$user" ]; then if [ -e "/var/spool/cron/$user" ]; then
cron_list='yes' cron_list='yes'
cp /var/spool/cron/$user $tmpdir/cron/ cp /var/spool/cron/$user $tmpdir/cron/
fi fi
echo
if [ -z "$output" ]; then
echo
fi
fi fi
# SSL CERTIFICATES # SSL CERTIFICATES
if [ ! -z "$WEB_SSL" ] && [ "$WEB_SSL" != 'no' ] && [ "$SSL" != '*' ]; then if [ ! -z "$WEB_SSL" ] && [ "$WEB_SSL" != 'no' ] && [ "$SSL" != '*' ]; then
if [ -z "$output" ]; then echo "-- SSL --"
echo "-- SSL --"
fi
mkdir $tmpdir/ssl mkdir $tmpdir/ssl
# Backingup ssl certificates # Backingup ssl certificates
@ -443,16 +364,10 @@ if [ ! -z "$WEB_SSL" ] && [ "$WEB_SSL" != 'no' ] && [ "$SSL" != '*' ]; then
tr '\n' ' ' |\ tr '\n' ' ' |\
sed -e 's/ $//' ) sed -e 's/ $//' )
for cert in $cert_list; do for cert in $cert_list; do
if [ -z "$output" ]; then echo -e "$(date "+%F %T") $cert"
echo -e "\t$(date +%H:%M:%S) $cert"
fi
cp $V_USERS/$user/ssl/$cert.* $tmpdir/ssl/ cp $V_USERS/$user/ssl/$cert.* $tmpdir/ssl/
done done
echo
if [ -z "$output" ]; then
echo
fi
fi fi
# Get backup size # Get backup size
@ -463,15 +378,13 @@ end_time=$(date '+%s')
# Defining local storage function # Defining local storage function
local_backup(){ local_backup(){
if [ -z "$output" ]; then echo "-- STORAGE --"
echo "-- STORAGE --" echo -e "$(date "+%F %T") ARCHIVE $V_BACKUP/$user.$V_DATE.tar"
echo -e "\t$(date +%H:%M:%S) ARCHIVE $V_BACKUP/$user.$V_DATE.tar"
fi
# Removing dublicate for this day # Removing dublicate for this day
if [ -e "$V_BACKUP/$user.$V_DATE.tar" ]; then if [ -e "$V_BACKUP/$user.$V_DATE.tar" ]; then
deprecated="$V_DATE" deprecated="$V_DATE"
echo -e "\tDeleting old backup for $V_DATE" echo -e "Deleting old backup for $V_DATE"
rm -f $V_BACKUP/$user.$V_DATE.tar rm -f $V_BACKUP/$user.$V_DATE.tar
fi fi
@ -487,9 +400,7 @@ local_backup(){
# Removing old backup # Removing old backup
backup_date=$(echo $backup | sed -e "s/$user.//" -e "s/.tar$//") backup_date=$(echo $backup | sed -e "s/$user.//" -e "s/.tar$//")
deprecated="$deprecated $backup_date" deprecated="$deprecated $backup_date"
if [ -z "$output" ]; then echo -e "\tDeleteing old backup for $backup_date"
echo -e "\tDeleteing old backup for $backup_date"
fi
rm -f $V_BACKUP/$backup rm -f $V_BACKUP/$backup
done done
fi fi
@ -507,12 +418,8 @@ local_backup(){
tar -cf $V_BACKUP/$user.$V_DATE.tar . tar -cf $V_BACKUP/$user.$V_DATE.tar .
chmod 640 $V_BACKUP/$user.$V_DATE.tar chmod 640 $V_BACKUP/$user.$V_DATE.tar
chown root:$user $V_BACKUP/$user.$V_DATE.tar chown root:$user $V_BACKUP/$user.$V_DATE.tar
localbackup='yes' localbackup='yes'
echo
if [ -z "$output" ]; then
echo
fi
} }
@ -530,9 +437,7 @@ EOF
# Defining ftp storage function # Defining ftp storage function
ftp_backup(){ ftp_backup(){
if [ -z "$output" ]; then echo "-- FTP --"
echo "-- FTP --"
fi
# Checking config # Checking config
source $V_CONF/ftp.backup.conf source $V_CONF/ftp.backup.conf
@ -544,10 +449,8 @@ ftp_backup(){
fi fi
# Debug info # Debug info
if [ -z "$output" ]; then echo -ne "$(date "+%F %T") "
echo -ne "\t$(date +%H:%M:%S) " echo -e "ftp://$USERNAME@$HOST$BPATH/$user.$V_DATE.tar"
echo -e "ftp://$USERNAME@$HOST$BPATH/$user.$V_DATE.tar"
fi
# Checking ftp permission # Checking ftp permission
ftmpdir=$(mktemp -u -p $BPATH) ftmpdir=$(mktemp -u -p $BPATH)
@ -565,12 +468,10 @@ ftp_backup(){
backups_count=$(echo "$backup_list" | wc -l) backups_count=$(echo "$backup_list" | wc -l)
if [ "$backups_count" -ge "$BACKUPS" ]; then if [ "$backups_count" -ge "$BACKUPS" ]; then
backups_rm_number=$((backups_count - BACKUPS + 1)) backups_rm_number=$((backups_count - BACKUPS + 1))
for backup in $(echo "$backup_list" | tail -n $backups_rm_number); do for backup in $(echo "$backup_list" | head -n $backups_rm_number); do
backup_date=$(echo $backup | sed -e "s/$user.//" -e "s/.tar$//") backup_date=$(echo $backup | sed -e "s/$user.//" -e "s/.tar$//")
deprecated="$deprecated $backup" deprecated="$deprecated $backup"
if [ -z "$output" ]; then echo -e "\tDeleteing old backup for $backup_date"
echo -e "\tDeleteing old backup for $backup_date"
fi
ftpc "delete $backup" ftpc "delete $backup"
done done
fi fi
@ -581,15 +482,12 @@ ftp_backup(){
ftpc "put $user.$V_DATE.tar" ftpc "put $user.$V_DATE.tar"
else else
cd $tmpdir cd $tmpdir
tar -cf $V_TMP/$user.$V_DATE.tar . tar -cf $V_BACKUP/$user.$V_DATE.tar .
cd $V_TMP/ cd $V_BACKUP/
ftpc "put $user.$V_DATE.tar" ftpc "put $user.$V_DATE.tar"
rm -f $user.$V_DATE.tar rm -f $user.$V_DATE.tar
fi fi
echo
if [ -z "$output" ]; then
echo
fi
} }
# Switching on backup system types # Switching on backup system types
@ -607,21 +505,18 @@ rm -rf $tmpdir
# Calculation run time # Calculation run time
run_time=$((end_time - start_time)) run_time=$((end_time - start_time))
run_time=$((run_time / 60)) run_time=$((run_time / 60))
current_time=$(date +'%H:%M:%S') current_time=$(date "+%T")
if [ "$run_time" -lt 1 ]; then if [ "$run_time" -lt 1 ]; then
run_time=1 run_time=1
fi fi
if [ -z "$output" ]; then min=miutes
min=miutes if [ "$run_time" -eq 1 ]; then
if [ "$run_time" -eq 1 ]; then min=minute
min=minute
fi
echo "$(date +'%m-%d-%y %H:%M:%S') Backup took $run_time $min"
echo
echo
fi fi
echo "$(date "+%F %T") Backup took $run_time $min"
echo
echo
#----------------------------------------------------------# #----------------------------------------------------------#

View file

@ -64,7 +64,7 @@ esac
#----------------------------------------------------------# #----------------------------------------------------------#
# Hiding password # Hiding password
V_EVENT="$(date +%m-%d-%y" "%H:%M:%S) $V_SCRIPT $user $database *****" V_EVENT="$V_DATE $V_SCRIPT $user $database *****"
# Logging # Logging
log_event 'system' "$V_EVENT" log_event 'system' "$V_EVENT"

View file

@ -45,7 +45,7 @@ echo "$password" | /usr/bin/passwd "$user" --stdin >/dev/null 2>&1
#----------------------------------------------------------# #----------------------------------------------------------#
# Hiding password # Hiding password
V_EVENT="$(date +%m-%d-%y" "%H:%M:%S) $V_SCRIPT $user *****" V_EVENT="$V_DATE $V_SCRIPT $user *****"
# Logging # Logging
log_event 'system' "$V_EVENT" log_event 'system' "$V_EVENT"

Binary file not shown.

View file

@ -39,7 +39,7 @@ fi
# Defining fileds to select # Defining fileds to select
fields="\$DATE \$TIME \$RUNTIME \$TYPE \$SIZE \$VESTA \$PAM \$WEB \$DNS \$DB" fields="\$DATE \$TIME \$RUNTIME \$TYPE \$SIZE \$VESTA \$PAM \$WEB \$DNS \$DB"
fields="$fields \$MAIL \$CERTIFICATES \$CRON" fields="$fields \$MAIL \$SSL \$CRON"
# Listing domains # Listing domains
case $format in case $format in

View file

@ -222,7 +222,7 @@ fi
# Checking ftp # Checking ftp
if [ "$type" == 'ftp' ]; then if [ "$type" == 'ftp' ]; then
tmpdir=$(mktemp -p $V_TMP -d) tmpdir=$(mktemp -p $V_BACKUP -d)
ftmpdir=$(basename $tmpdir) ftmpdir=$(basename $tmpdir)
init_ftp_variables init_ftp_variables
check_ftp_connection check_ftp_connection
@ -244,7 +244,7 @@ fi
# Checking both local and ftp # Checking both local and ftp
if [ "$type" == 'ftp,local' ] || [ "$type" == 'local,ftp' ]; then if [ "$type" == 'ftp,local' ] || [ "$type" == 'local,ftp' ]; then
tmpdir=$(mktemp -p $V_TMP -d) tmpdir=$(mktemp -p $V_BACKUP -d)
ftmpdir=$(basename $tmpdir) ftmpdir=$(basename $tmpdir)
init_ftp_variables init_ftp_variables
check_ftp_connection check_ftp_connection
@ -279,6 +279,9 @@ fi
if [ -e "$tmp_file" ]; then if [ -e "$tmp_file" ]; then
cat $tmp_file | sort > $V_USERS/$user/backup.conf cat $tmp_file | sort > $V_USERS/$user/backup.conf
rm $tmp_file rm $tmp_file
else
rm $V_USERS/$user/backup.conf
touch $V_USERS/$user/backup.conf
fi fi

View file

@ -106,7 +106,7 @@ for user in $user_list; do
source $V_USERS/$user/user.conf source $V_USERS/$user/user.conf
# Redefining date # Redefining date
DATE=$(date -d "$(date +'%m/01') -1day" +%m-%d-%y) DATE=$(date -d "$(date +'%m/01') -1day" +%F)
# Compiling report string # Compiling report string
v_str="DATE='$DATE' PACKAGE='$PACKAGE'" v_str="DATE='$DATE' PACKAGE='$PACKAGE'"

View file

@ -41,7 +41,7 @@ int main (int argc, char** argv) {
time_t lt = time(NULL); time_t lt = time(NULL);
struct tm* ptr = localtime(&lt); struct tm* ptr = localtime(&lt);
char str[280]; char str[280];
strftime(str, 100, "%m-%d-%y %H:%m:%S ", ptr); strftime(str, 100, "%Y-%m-%d %H:%M:%S ", ptr);
// openning log file // openning log file
FILE* pFile = fopen ("/usr/local/vesta/log/auth.log","a+"); FILE* pFile = fopen ("/usr/local/vesta/log/auth.log","a+");