????
Current Path : /proc/self/root/lib/Acronis/BackupAndRecovery/ |
Current File : //proc/self/root/lib/Acronis/BackupAndRecovery/systeminfo |
#!/bin/bash # This is Acronis Linux Report Utility. It's absolutely harmless for your # system and security. Please run this utility under privileged user and # send us resulted sysinfo archive from /var/lib/Acronis/sysinfo directory. # Copyright (C) Acronis, 2010 # Initially written by Fadeeva Marina # (marian.fadeeva@acronis.com) opt_dir=/opt opt_acronis=$opt_dir/acronis opt_site_agent=$opt_dir/site-agent etc_acronis=/etc/Acronis usr_local_dir=/usr/local rpm_dist=/bin/rpm dpkg_dist=/usr/bin/dpkg libdir=/usr/lib/Acronis var_dir=/var/lib/Acronis var_log_dir=/var/log/Acronis aties=$libdir/Agent/agent abr=$libdir/BackupAndRecoveryAgent atiesecho=$libdir/Agent/acronisagent abrams=$libdir/AMS/ManagementServer online_backup_dir=$var_dir/BackupAndRecovery/OnlineBackup psa_mod_acronis_dir=psa/var/modules/acronis-backup/srv/ cpanel_3rdparty_dir=cpanel/base/3rdparty/acronisbackup direct_admin_dir=directadmin/plugins/acronisbackup direct_admin_logs_dir=/var/log/directadmin opt_var_log_dir=$opt_acronis/var/log opt_var_aakore=$opt_acronis/var/aakore opt_sa_var_log_dir=$opt_site_agent/var/log opt_sa_var_aakore=$opt_site_agent/var/core opt_managment_agent_var=$opt_acronis/management_agent/var opt_license_manager_db=$opt_managment_agent_var/license-manager opt_license_manager_log=$opt_managment_agent_var/log/license-manager opt_var_vcd_ma_dir=$opt_acronis/var/vmware-cloud-director-management-agent opt_managment_agent_etc=$opt_acronis/management_agent/etc # collect full contents from specific_dirs=" $var_dir/AMS/AccessVault $var_dir/BackupAndRecovery/MMS/AccessVault $var_dir/BackupAndRecovery/MMS/Activity $var_dir/CurlCaCertificates $var_dir/NGMP/userdata $var_dir/Scheduler/tasks $var_dir/vix_disk_lib $var_dir/VirtualApplianceCoreDumps /var/lib/alsdb /var/log/AcronisRemoteInstall/logs $opt_acronis/Acroinst2/logs $opt_managment_agent_var $opt_managment_agent_etc" specific_dirs_media="/ConfigurationFiles" # collect all the Acronis databases (-shm and -wal files will be collected as well) db3_ext_templates="sqlite sqlite3 db db3" db3_dirs="$var_dir $libdir" # collect logs from logs_files_exts="log log.gz output trace stat zst" logs_dirs="$var_log_dir $var_dir $opt_var_log_dir $opt_sa_var_log_dir" # collect conf files from conf_files_exts="config cfg conf meta ini sh csv xml sql yaml yml json" conf_dirs="$etc_acronis $var_dir $opt_acronis $opt_site_agent $libdir" procfiles="version cmdline interrupts modules bus/pci/devices bus/usb/devices partitions scsi/scsi mounts cpuinfo meminfo mdstat devices bus/input/devices swaps fb slabinfo diskstats" procdirs="/proc/bus/pci /proc/bus/usb /proc/bus/input /sys/bus/acpi" slabfiles="objects object_size objs_per_slab order slabs slab_size" df_options="-hT" ver="" ver2="" export LANG=C # Parse options script_name="$0" silent_mode="0" is_dir_mode="0" day_filter="0" ensure_root="1" is_progress_mode="0" optimized_mode="0" max_file_size="0" default_tgtdir="/var/lib/Acronis/sysinfo" syslog_tgtdir="syslog" default_filename=sysinfo-$(date +%Y.%m.%d-%H.%M.%S).tar.bz2 filename=$default_filename services_files_usr="/usr/sbin/dkms /usr/sbin/acropsh /usr/sbin/acronis_ams /usr/sbin/acronis_asm /usr/sbin/acronis_zmqgw /usr/sbin/acrocmd /usr/sbin/aakore /usr/sbin/acronis_rsm /usr/sbin/acronis_encrypt /usr/sbin/acronis_mms /usr/sbin/acronis_schedule /usr/sbin/schedmgr /usr/sbin/tibxread /usr/sbin/mediabuilder /usr/sbin/trueimagemnt /usr/sbin/acronis_apply_device_filter /usr/sbin/acronis_setup_device_filter /usr/sbin/acronis_monitoring_collector /usr/sbin/acronis_monitoring_service /usr/sbin/acronis_patch_management /usr/sbin/acronis_notification_service /usr/lib/Acronis/system_libs/config /usr/lib/Acronis/system_libs/8.2.1/config" services_files_etc="/etc/systemd/system/acronis_device_filter.service /etc/systemd/system/acronis_monitoring_service.service /etc/systemd/system/acronis_ams.service /etc/systemd/system/acronis_asm.service /etc/systemd/system/acronis_zmqgw.service /etc/systemd/system/aakore.service /etc/systemd/system/acronis_mms.service /etc/systemd/system/acronis_rsm.service /etc/systemd/system/acronis_schedule.service" services_files_dir=services_files umask 0077 while [ "$#" -gt 0 ]; do case "$1" in -h|--help) echo "Acronis Report Utility" echo "" echo "EXAMPLES" echo " Save sysinfo into $default_tgtdir/$default_filename:" echo " $script_name" echo "" echo " Save sysinfo into specified directory:" echo " $script_name --target_dir path/to/report/dir" echo "" echo " Save compressed sysinfo into specified file:" echo " $script_name --target_file path/to/report/archive.tar.bz2" echo " (path can be absolute or relative to $default_tgtdir)" echo "" echo " Optimization mode (some files were skipped):" echo " $script_name --optimized" echo "" echo " Set max file size in the report (in Mb):" echo " $script_name --max_size <Size_Mb>" echo "" echo " Collect data for the last several days prior to current date:" echo " $script_name --days <Days>" echo " $script_name -d <Days>" echo "" echo " Print this help and exit:" echo " $script_name --help" echo "" exit 0 ;; --silent) silent_mode="1" shift ;; --optimized) optimized_mode="1" if [[ $day_filter -eq 0 ]]; then day_filter=1 fi if [[ $max_file_size -eq 0 ]]; then max_file_size=100 fi specific_dirs=" $var_dir/CurlCaCertificates $var_dir/NGMP/userdata $var_dir/Scheduler/tasks $var_dir/vix_disk_lib $var_dir/VirtualApplianceCoreDumps $opt_managment_agent_var $opt_managment_agent_etc" shift ;; --max_size) if [ "$#" -lt 2 ]; then >&2 echo "ERROR: value of $1 option is not specified" >&2 echo "" exit 1 fi max_file_size=$2 shift 2 ;; --skip_root_check) ensure_root="0" shift ;; --progress) is_progress_mode="1" shift ;; --target_file) is_dir_mode="0" if [ "$#" -lt 2 ]; then >&2 echo "ERROR: value of $1 option is not specified" >&2 echo "" exit 1 fi filename=$2 shift 2 ;; --target_dir) is_dir_mode="1" if [ "$#" -lt 2 ]; then >&2 echo "ERROR: value of $1 option is not specified" >&2 echo "" exit 1 fi filename=$2 shift 2 ;; -d|--days) if [ "$#" -lt 2 ]; then >&2 echo "ERROR: value of $1 option is not specified" >&2 echo "" exit 1 fi day_filter=$2 shift 2 ;; *) >&2 echo "Unexpected argument $1" >&2 echo "Run $0 --help to get usage examples" exit 1 ;; esac done case $filename in /*) result_abs_path="$filename" ;; *) result_abs_path="$default_tgtdir/$filename" ;; esac function report_progress { if [ "$is_progress_mode" -eq "1" ]; then echo "Progress:" $1 fi } function message { if [ "$silent_mode" -eq "0" ]; then echo $* fi } # location of intermediary data if [ "$is_dir_mode" -eq "1" ]; then work_dir="$result_abs_path" else work_dir=$default_tgtdir/logs if [ -d "$work_dir" ]; then rm -rf $work_dir fi fi mkdir -p $work_dir cd $work_dir mkdir -p $syslog_tgtdir # make sure script is run by root if [ -x /bin/asamba ]; then # this is media version. No need to check if run by root df_options="-h" specific_dirs="$specific_dirs $specific_dirs_media" else if [ "$ensure_root" -eq "1" ]; then is_root="0" test -x /usr/bin/id && is_root="$(/usr/bin/id -u)" if [ "$is_root" -ne "0" ] ; then >&2 echo You must be root to run this script! exit 1 fi fi fi # switch into working directory and start collecting sysinfo message Please wait for a while ... #initial progress report_progress 0 # Check ACRONIS_PROC_PARTITIONS_LOCATION environment variable and copy file if it exists acronis_proc_partitions="acronis_proc_partitions.txt" if [ -n "$ACRONIS_PROC_PARTITIONS_LOCATION" ]; then if [ -f "$ACRONIS_PROC_PARTITIONS_LOCATION" ]; then cp "$ACRONIS_PROC_PARTITIONS_LOCATION" ./$acronis_proc_partitions 2>&1 else echo "Warning: ACRONIS_PROC_PARTITIONS_LOCATION doesn't point out on the file" > ./$acronis_proc_partitions 2>&1 fi fi # Collect info about self execution exec 2> sysinfo_script.log set -x unset LD_PRELOAD unset LD_LIBRARY_PATH set 1>&2 max_file_size_bytes=$(($max_file_size*1024*1024)) # bytes count last_lines_count=$(($max_file_size_bytes/300)) # 300 bytes (chars) ~ 1 line optimization_log="optimization.log" if [ $optimized_mode -eq "1" ]; then msg="Optimization mode is enabled." message "$msg" echo "$msg" >> ./$optimization_log fi if [ $day_filter -gt 0 ]; then msg="Collect data for the last $day_filter day(s) prior to current date." message "$msg" echo "$msg" >> ./$optimization_log fi if [ $max_file_size -gt 0 ]; then msg="Max size of 1 log file is $max_file_size Mb." message "$msg" echo "$msg" >> ./$optimization_log fi # truncate big log's file $1 - filename $2- output dir (optional) function truncate_file { if [ -r $1 ]; then ([ $# -lt 1 ] || [ $# -gt 2 ]) && echo "WARNING. Wrong command: '$FUNCNAME $*'. Arguments: '<LOG_FILE> [OUT_DIR]'" >> ./$optimization_log && return 1 local out_dir="." if [ $# -eq 2 ]; then [ ! -d $2 ] && mkdir -p $2 2>&1 out_dir=$2 fi if [ "$optimized_mode" -eq "1" ]; then size=`wc -c < $1` 2>&1 if [ $size -gt $max_file_size_bytes ]; then local f_name="./$out_dir/$(basename $1)_crop" tail -$last_lines_count $1 > $f_name 2>&1 echo "ATTENTION: '$f_name' was truncated. It contains $last_lines_count last lines" >> ./$optimization_log else cp -r $1 $out_dir 2>&1 fi else cp -r $1 $out_dir 2>&1 fi fi } # check files before copy $1 - source file, $2 - target file (optional) function copy_file { if [ -r "$1" ]; then local target_name=$(basename "$1") if [ $# -eq 2 ]; then if [ -d "$2" ]; then target_name="$2/$target_name" else target_name="$2" fi fi cp "$1" "./$target_name" 2>&1 fi } # check files before copy $1 - source file, $2 - target dir (optional) function copy_file_with_parents { local out_dir="." [ $# -eq 2 ] && out_dir="$2" && [ ! -d "$2" ] && mkdir -p "$2" 2>&1 [ -r "$1" ] && cp --parents "$1" "./$out_dir/" 2>&1 } # implementation day filter for file: $1 - file, $2 - output file function day_filter_file { if [ -r "$1" ]; then [ $# -ne 2 ] && echo "WARNING. Wrong command: '$FUNCNAME $*'. Arguments: '<IN_FILE> <OUT_FILE>'" >> ./$optimization_log && return 1 if [ $day_filter -gt 0 ] && [ $# -eq 2 ]; then find $1 -type f -mtime -$day_filter -exec cp "{}" "./$2" \; 2>&1 else cp -r "$1" "./$2" 2>&1 fi fi } # implement day filter for files starting with pattern: $1 - source dir, $2 - pattern, $3 - output dir function day_filter_files_by_pattern { if [ -d "$1" ]; then [ $# -ne 3 ] && echo "WARNING. Wrong command: '$FUNCNAME $*'. Arguments: '<SEARCH_DIR> <PATTERN> <OUT_DIR>'" >> ./$optimization_log && return 1 [ ! -d "$3" ] && mkdir -p "$3" if [ $day_filter -gt 0 ] && [ $# -eq 3 ]; then find "$1" -maxdepth 1 -name "$2" -type f -mtime -$day_filter -exec cp "{}" "./$3/" \; 2>&1 else find "$1" -maxdepth 1 -name "$2" -type f -exec cp "{}" "./$3/" \; 2>&1 fi fi } if [ -x /bin/uname ]; then ver=/lib/modules/`/bin/uname -r`/kernel/drivers/block/snapapi* ver2=/lib/modules/`/bin/uname -r`/kernel/drivers/extra/snapapi* fi # Start from checking kernel version and setting # proprer snapapi module name report_progress 1 snapapi_ver=snapapi26 # it's 2.6 or upper kernel find --help |grep -q "\[-L\]" if [ "$?" -eq "0" ]; then symlnk_opt="-L" fi # collect the services files of product mkdir -p $services_files_dir for f in $services_files_usr do copy_file_with_parents $f $services_files_dir done for f in $services_files_etc do copy_file_with_parents $f $services_files_dir copy_file_with_parents "$f.rpmnew" $services_files_dir copy_file_with_parents "$f.rpmsave" $services_files_dir done # get the logs of attempt to compile dkms modules. for i in `find /var/lib/dkms -name make.log|grep /build/`; do curr_dir="`dirname $i|sed -e 's|/var/lib/dkms/||g'`" mkdir -p dkms_logs/$curr_dir cp $i dkms_logs/$curr_dir done copy_file /etc/config etc_config copy_file /etc/hosts hosts.txt copy_file /etc/ProductVersion.conf copy_file /usr/lib/Acronis/BackupAndRecovery_version.txt copy_file /var/lib/Acronis/BackupAndRecovery_version.txt # Common for all versions if [ -x /usr/sbin/acrocmd ]; then #Live Linux /usr/sbin/acrocmd list disks > acrocmd.txt 2>&1 elif [ -x /bin/acrocmd ]; then /bin/acrocmd list disks > acrocmd.txt 2>&1 elif [ -x /usr/sbin/trueimagecmd ]; then #Live Linux /usr/sbin/trueimagecmd --list > trueimagecmd.txt 2>&1 elif [ -x /bin/trueimagecmd ]; then /bin/trueimagecmd --list > trueimagecmd.txt 2>&1 fi report_progress 10 # Gather information about dsk_supp state # should be done before $logs_dirs are gathered because it writes additional debug logs if [ -x /usr/lib/Acronis/BackupAndRecovery/dsk_supp_test ]; then DSK_DSK__LOG=1 /usr/lib/Acronis/BackupAndRecovery/dsk_supp_test > dsk_supp_test.txt 2>&1 elif [ -x /bin/dsk_supp_test ]; then DSK_DSK__LOG=1 /bin/dsk_supp_test > dsk_supp_test.txt 2>&1 fi # save /tmp/asamba.log if exist # save all logs from /var/log/asamba copy_file /tmp/asamba.log day_filter_files_by_pattern /var/log/asamba/ "*" . # Schedmgr report on Live Linux if [ -x /usr/sbin/schedmgr ]; then /usr/sbin/schedmgr get report > schedmgr_report.txt 2>&1 # Schedmgr report on VA elif [ -x /bin/schedmgr ]; then /bin/schedmgr get report > schedmgr_report.txt 2>&1 fi # Now check X-Server logs: # Do we have xorg? if [ -r /etc/X11/xorg.conf ]; then cp /var/log/Xorg* ./$syslog_tgtdir/ 2>&1 # or is it XFree86? elif [ -r /etc/X11/XF86Config ]; then cp /var/log/XFree86* ./$syslog_tgtdir/ 2>&1 fi # Common for all agents if [ -x "$aties" ] || [ -x "$atiesecho" ]; then /sbin/iptables -L > iptables.txt 2>&1 /sbin/lsmod | grep snapapi* > /dev/null if [ "$?" -eq 0 ]; then /sbin/rmmod $snapapi_ver > rmmod.txt 2>&1 fi if [ -e "$ver" ] || [ -e "$ver2" ]; then /sbin/modprobe $snapapi_ver fi fi # agents common # For ATIES Linux agent 9.1 if [ -x "$aties" ]; then /etc/init.d/acronis_trueimage_agent status > agent.txt 2>&1 fi # For ATIES ECHO Linux agent if [ -x "$atiesecho" ]; then /etc/init.d/acronis_agent status > agent.txt 2>&1 fi # For ABR Agent if [ -x "$abr" ]; then /etc/init.d/acronis_agent status > agent.txt 2>&1 /etc/init.d/acronis_mms status > mms.txt 2>&1 copy_file $etc_acronis/BackupAndRecovery.config fi # For ABR AMS if [ -x "$abrams" ]; then /etc/init.d/acronis_ams status > ams.txt 2>&1 copy_file $etc_acronis/AMS.config #dump PostgreSQL database # disabled as most installations use sqlite database and it is collected. # # pg_dump acronis_cms -Fc | gzip > acronis_cms.gz fi report_progress 20 copy_file "/tmp/AcronisAMS.log" copy_file "/tmp/AcronisMMS.log" # Then gather system information # Some systems have kernel config in /proc/. Let's save it if [ -r /proc/config.gz ]; then gunzip /proc/config.gz . 2>&1 mv config proc_config 2>&1 fi /sbin/fdisk -l > fdisk.txt 2>&1 copy_file /etc/issue issue.txt copy_file /etc/os-release os-release.txt copy_file /etc/resolv.conf resolv.txt if [ -x /usr/sbin/gdisk ] || [ -x /bin/gdisk ]; then for i in `cat /proc/partitions | awk '{print $4}' | grep -v [0-9]`; do if [ -e "/dev/$i" ]; then # Use echo to avoid gdisk questions. Details in ABR-152465 echo 1 | gdisk -l /dev/$i >> gdisk.txt 2>&1 fi done fi if [ -x /bin/uname ]; then /bin/uname -a > uname.txt 2>&1 fi #just in case we're on GPT system if [ -x /sbin/parted ]; then parted -sl > parted.txt 2>&1 fi if [ -x /bin/lsblk ]; then /bin/lsblk > lsblk.txt 2>&1 fi if [ -x /sbin/lsof ]; then echo "$ /sbin/lsof" > lsof.txt /sbin/lsof >> lsof.txt 2>&1 fi if [ -x /usr/bin/stratis ]; then echo "$ /usr/bin/stratis pool" > stratis.txt /usr/bin/stratis pool >> stratis.txt 2>&1 echo "$ /usr/bin/stratis blockdev" >> stratis.txt /usr/bin/stratis blockdev >> stratis.txt 2>&1 echo "$ /usr/bin/stratis filesystem" >> stratis.txt /usr/bin/stratis filesystem >> stratis.txt 2>&1 fi if [ -x /sbin/iscsiadm ]; then echo "$ /sbin/iscsiadm -m discoverydb" > iscsi.txt /sbin/iscsiadm -m discoverydb >> iscsi.txt 2>&1 echo "$ /sbin/iscsiadm -m node" >> iscsi.txt /sbin/iscsiadm -m node >> iscsi.txt 2>&1 echo "$ /sbin/iscsiadm -m session" >> iscsi.txt /sbin/iscsiadm -m session >> iscsi.txt 2>&1 fi #Creating summary.txt file with general system information echo `date` >> summary.txt 2>&1 for i in $procfiles do if [ -r /proc/$i ]; then echo "$ cat /proc/$i" >> summary.txt cat /proc/"$i" >> summary.txt 2>&1 fi done for i in $procdirs do # special procedure to copy files from /proc if [ -d $i ]; then proc_out=`basename $i` mkdir $proc_out rm -rf $proc_out find $i -type f | while read F ; do D=$proc_out/$(dirname $F) test -d $D || mkdir -p $D test -f $proc_out/$F || cat $F > $proc_out/$F done tar -jcf $proc_out.tar.bz2 $proc_out rm -rf $proc_out fi done echo "$ blockdev --report" >> summary.txt blockdev --report >> summary.txt 2>&1 echo "$ locale -a" >> summary.txt if command -v locale > /dev/null 2>&1; then locale -a >> summary.txt 2>&1 else echo "The 'locale' command is not available on this system." fi for sdir in `find /sys/kernel/slab -name snapapi_blk_*` ; do echo $sdir >> snapapi_slabs.txt 2>&1 for sfile in $slabfiles do if [ -r "$sdir/$sfile" ]; then echo "$ cat $sdir/$sfile" >> snapapi_slabs.txt cat "$sdir/$sfile" >> snapapi_slabs.txt 2>&1 fi done echo >> snapapi_slabs.txt 2>&1 done # DO NOT CUT: dmesg has small buffer-size by default if [ -x /bin/dmesg ]; then /bin/dmesg > ./$syslog_tgtdir/dmesg.txt 2>&1 if [ ! -x /bin/acronis ]; then /bin/dmesg -T > ./$syslog_tgtdir/dmesg-datetime.txt 2>&1 fi fi # copy dmesg saved right after system startup copy_file /var/log/dmesg ./$syslog_tgtdir/dmesg report_progress 30 # configuration of software RAID dmraid_cmd=`which dmraid 2>/dev/null` if [ -n "$dmraid_cmd" ]; then $dmraid_cmd -rD > /dev/null 2>&1 $dmraid_cmd -n > dmraid_n.txt 2>&1 $dmraid_cmd -r > dmraid.txt 2>&1 fi if [ -x /usr/sbin/dkms ]; then /usr/sbin/dkms status > dkms.txt 2>&1 fi copy_file /var/log/trueimage-setup.log copy_file /etc/fstab day_filter_files_by_pattern /var/log/ "messages*" $syslog_tgtdir day_filter_files_by_pattern /var/log/ "syslog*" $syslog_tgtdir # for systemd-based systems collect journal logs for the last month if which journalctl >/dev/null 2>&1; then if [[ $day_filter -gt 0 ]]; then journalctl --no-pager -a --since "$day_filter days ago" > ./$syslog_tgtdir/journalctl.txt 2>&1 else journalctl --no-pager -a --since=-1month > ./$syslog_tgtdir/journalctl.txt 2>&1 fi # gather Agent Bootstraper logs in JSON format journalctl -u cloud-connection-site-agent-bootstrapper -a -o json > ./$syslog_tgtdir/cloud-connection-site-agent-bootstrapper.txt 2>&1 fi # Ubuntu saves kernel log to kern.log unstead of messages truncate_file /var/log/kern.log ./$syslog_tgtdir/ if [ -x /bin/getmeta ]; then # let's call it first /bin/getmeta cp /tmp/*.hex . cp /tmp/*.dd . fi bin_path_prefix="/usr" # save logs from /tmp when on media if [ -x /bin/acronis ]; then cp /tmp/*.log . cp /tmp/*.log.?.gz . bin_path_prefix="" else cp /tmp/*_asan.log . 2>/dev/null fi report_progress 40 # collect routing information routing_filename="routing.txt" echo "routing information:" > $routing_filename if [ -x $bin_path_prefix/bin/netstat ]; then echo -e "\n\n>\$netstat -rn" >> $routing_filename $bin_path_prefix/bin/netstat -rn >> $routing_filename fi if [ -x $bin_path_prefix/sbin/route ]; then echo -e "\n\n>\$route -n" >> $routing_filename $bin_path_prefix/sbin/route -n >> $routing_filename fi if [ -x $bin_path_prefix/sbin/ip ]; then echo -e "\n\n>\$ip route" >> $routing_filename $bin_path_prefix/sbin/ip route >> $routing_filename fi if [ -x /sbin/lspci ]; then /sbin/lspci -m -vvv > lspci.txt 2>&1 elif [ -x /bin/lspci ]; then /bin/lspci -m -vvv > lspci.txt 2>&1 fi if [ -d /boot ]; then cp /boot/config* . 2>&1 ls -lR /boot > boot.txt 2>&1 fi if [ -x /sbin/ifconfig ]; then /sbin/ifconfig -a > ifconfig.txt 2>&1 elif [ -x /bin/ifconfig ]; then /bin/ifconfig -a > ifconfig.txt 2>&1 fi if [ -x /usr/bin/gcc ]; then /usr/bin/gcc -v > gcc.txt 2>&1 fi if [ -x /bin/chronyc ]; then chronyc sources > chronyc_sources.txt 2>&1 chronyc tracking > chronyc_tracking.txt 2>&1 fi if [ -r /etc/chrony.conf ]; then cp /etc/chrony.conf . 2>&1 fi if [ -x /bin/ntpstat ]; then ntpstat > ntpstat.txt 2>&1 fi if [ -r /etc/TZ ]; then (cat /etc/TZ && date -u && date) > timezone.txt 2>&1 else ( date -u && date) > timezone.txt 2>&1 fi environments_dir="environments" mkdir $environments_dir env > $environments_dir/env.txt ps auxfww > ps.txt 2>&1 if [ "X$?" = "X1" ]; then #ps in Bootable Media supports only "wlT" modes ps wl > ps.txt 2>&1 cat ps.txt|grep -e aakore -e product.bin -e udhcpc -e acronis -e asamba > $environments_dir/progs.txt for i in `cat $environments_dir/progs.txt|awk '{print $1}'`; do cat /proc/$i/environ |tr '\0' '\n' > $environments_dir/env_$i.txt done else cat ps.txt|grep -i acronis > $environments_dir/progs.txt for i in `cat ps.txt|grep -i acronis|awk '{print $2}'`; do cat /proc/$i/environ |tr '\0' '\n' > $environments_dir/env_$i.txt done fi if [ -x /usr/bin/crontab ]; then /usr/bin/crontab -l > crontab.txt 2>&1 fi if [ -x /usr/sbin/dmidecode ]; then /usr/sbin/dmidecode > dmidecode.txt 2>&1 elif [ -x /bin/dmidecode ]; then /bin/dmidecode > dmidecode.txt 2>&1 fi if [ -d /sys/class/scsi_host ]; then find /sys/class/scsi_host -iname 'host*' -print -exec cat {}/proc_name \; > scsi_hosts.txt 2>&1 fi # df called in background to avoid hang on broken nfs shares df > df_space.txt 2>&1 & df $df_options > df_space_human.txt 2>&1 & df -i > df_inodes.txt 2>&1 & df -i $df_options > df_inodes_human.txt 2>&1 & report_progress 50 # Gather full contents of specified directoris for abs_src_dir in $specific_dirs do if [ -d "$abs_src_dir" ]; then tgt_dir=".$abs_src_dir" mkdir -p "$tgt_dir" for k in `ls -1 "$abs_src_dir"`; do cp -r "$abs_src_dir/$k" "$tgt_dir" ;done fi done #Gather vCD-MA databse. vcd_ma_db_name="$opt_var_vcd_ma_dir/db.db" if [ -r $vcd_ma_db_name ]; then tgt_dir=".$opt_var_vcd_ma_dir" mkdir -p "$tgt_dir" cp $vcd_ma_db_name "$tgt_dir" 2>&1 fi #Gather MMS and AMS databases db3_files_exts="" for ext in $db3_ext_templates do db3_files_exts="$db3_files_exts $ext $ext-shm $ext-wal" done for ext in $db3_files_exts do for abs_src_dir in `find $symlnk_opt $db3_dirs -name "*.$ext" -exec dirname {} \; | uniq` do case $abs_src_dir/ in ${work_dir}*) # do not copy files already located in work_dir ;; */sysinfo-*) # do not copy files from another sysinfo reports ;; ${var_dir}/mount*) # do not copy files in "mount" dir which has mounted backups ;; ${var_dir}/NGMP*) # do not copy files in "NGMP" dir ;; *) mkdir -p ."$abs_src_dir" for j in `ls -1 "$abs_src_dir" | grep "\.$ext$"` do cp -r "$abs_src_dir/$j" ."$abs_src_dir/$j" done ;; esac done done report_progress 60 #Gather Acronis logs for ext in $logs_files_exts do for abs_src_dir in `find $symlnk_opt $logs_dirs -name "*.$ext" -exec dirname {} \; | uniq` do case $abs_src_dir/ in ${work_dir}*) # do not copy files already located in work_dir ;; */sysinfo-*) # do not copy files from another sysinfo reports ;; ${var_dir}/mount*) # do not copy files in "mount" dir which has mounted backups ;; ${var_dir}/NGMP*) # do not copy files in "NGMP" dir ;; *) mkdir -p ."$abs_src_dir" for j in `ls -1 "$abs_src_dir" | grep "\.$ext$"` do day_filter_file "$abs_src_dir/$j" ./"$abs_src_dir/$j" done ;; esac done done #Gather screenshot validation files day_filter_files_by_pattern /tmp/screenshot_validation "*.png" ./screenshot_validation_files report_progress 70 #Gather Acronis conf files for ext in $conf_files_exts do for abs_src_dir in `find $symlnk_opt $conf_dirs -name "*.$ext" -exec dirname {} \; | uniq` do case $abs_src_dir/ in ${work_dir}*) # do not copy files already located in work_dir ;; */sysinfo-*) # do not copy files from another sysinfo reports ;; ${var_dir}/mount*) # do not copy files in "mount" dir which has mounted backups ;; ${var_dir}/NGMP*) # do not copy files in "NGMP" dir ;; *) mkdir -p ."$abs_src_dir" for j in `ls -1 "$abs_src_dir" | grep "\.$ext$"` do cp -r "$abs_src_dir/$j" ."$abs_src_dir/$j" done ;; esac done done report_progress 80 # Collect mms_bundle.config from VA copy_file /bin/mms_bundle.config #Gather Virtual Appliance databse. It's not in Acronis dir, but has fixed name mms_db_name="/var/lib/F4CEEE47-042C-4828-95A0-DE44EC267A28" if [ -r $mms_db_name.db3 ]; then cp $mms_db_name.* ./var/lib/ 2>&1 fi if [ -d $online_backup_dir ]; then ls -lR $online_backup_dir > online_backup.txt OPENSSL=/usr/bin/openssl if [ -x $OPENSSL ]; then for crt in `find $online_backup_dir -name '*.crt'`; do echo "[$crt]" >> online_backup.txt $OPENSSL x509 -in $crt -text -noout >> online_backup.txt 2>&1 done fi fi list_logs="config.ini acronis-backup-srv.db" if [ -d $usr_local_dir/$psa_mod_acronis_dir ]; then mkdir -p ./$psa_mod_acronis_dir for var in $list_logs do cp -r $usr_local_dir/$psa_mod_acronis_dir/$var ./$psa_mod_acronis_dir 2>&1 done day_filter_file $usr_local_dir/$psa_mod_acronis_dir/log /$psa_mod_acronis_dir elif [ -d $opt_dir/$psa_mod_acronis_dir ]; then mkdir -p ./$psa_mod_acronis_dir for var in $list_logs do cp -r $opt_dir/$psa_mod_acronis_dir/$var ./$psa_mod_acronis_dir 2>&1 done day_filter_file $opt_dir/$psa_mod_acronis_dir/log /$psa_mod_acronis_dir fi if [ -d $usr_local_dir/$cpanel_3rdparty_dir ]; then mkdir -p ./$cpanel_3rdparty_dir for var in config log update do cp -r $usr_local_dir/$cpanel_3rdparty_dir/$var ./$cpanel_3rdparty_dir done if [ -d $usr_local_dir/$cpanel_3rdparty_dir/srv ]; then mkdir -p ./$cpanel_3rdparty_dir/srv for var in $list_logs do cp -r $usr_local_dir/$cpanel_3rdparty_dir/srv/$var ./$cpanel_3rdparty_dir/srv 2>&1 done day_filter_file $usr_local_dir/$cpanel_3rdparty_dir/srv/log ./$cpanel_3rdparty_dir/srv fi fi truncate_file $usr_local_dir/cpanel/logs/error_log ./cpanel/logs if [ -d $usr_local_dir/$direct_admin_dir ]; then mkdir -p ./$direct_admin_dir for var in config log update do cp -r $usr_local_dir/$direct_admin_dir/$var ./$direct_admin_dir done if [ -d $usr_local_dir/$direct_admin_dir/srv ]; then mkdir -p ./$direct_admin_dir/srv for var in $list_logs do cp -r $usr_local_dir/$direct_admin_dir/srv/$var ./$direct_admin_dir/srv 2>&1 done day_filter_file $usr_local_dir/$direct_admin_dir/srv/log ./$direct_admin_dir/srv fi fi day_filter_files_by_pattern /var/log/directadmin/ "error*" ./directadmin/logs truncate_file /var/log/plesk/panel.log ./plesk/logs report_progress 90 # collect logs from vz containers test -e /etc/parallels-release if [ $? -eq 0 ]; then list_logs="capture-data-config.sh capture-data.log freeze_mysql.sql" for container in /vz/root/* do if [ -d $container/var/lib/Acronis/AgentCommData ]; then mkdir -p ./$container for var in $list_logs do truncate_file $container/var/lib/Acronis/AgentCommData/$var ./$container done fi done fi # SELINUX information if [ -r /etc/selinux/config ]; then /usr/sbin/sestatus > sestatus.txt 2>&1 fi # LVM information if [ -c /dev/mapper/control ]; then dmsetup table > dmsetup_table.txt 2>&1 type lvm >/dev/null 2>&1 if [ "$?" -eq "0" ]; then lvm pvdisplay -v > pvdisplay.txt 2>&1 lvm vgdisplay -v > vgdisplay.txt 2>&1 lvm lvdisplay -v > lvdisplay.txt 2>&1 fi fi # multipath if [ -r /dev/mpath ]; then multipath -v 3 -ll > multipath.txt 2>&1 fi # Then will gather information about installed pakages. # Currently only for rpm and dpkg - based. if [ -x "$rpm_dist" ]; then /bin/rpm -qa --queryformat "%{NAME}-%{VERSION}-%{RELEASE}.%{ARCH}\n" \ > rpm_packages.txt 2>&1 fi if [ -x "$dpkg_dist" ]; then dpkg-query -W -f='${Package} ${Version} ${Architecture}\n' \ > dpkg_packages.txt 2>&1 fi # Try to find loader's config file: # Start from grub.conf copy_file /boot/grub/grub.conf # Then menu.lst copy_file /boot/grub/menu.lst # Then GRUB2 config copy_file /boot/grub2/grub.cfg copy_file /boot/grub2/i386-pc/grub.cfg # And GRUB2 environment copy_file /boot/grub2/grubenv copy_file /boot/grub2/i386-pc/grubenv # and for lilo.conf copy_file /etc/lilo.conf # And GRUB's device map copy_file /boot/grub/device.map copy_file /boot/grub2/device.map # gather some files for VZ copy_file /etc/vz/vz.conf copy_file /etc/parallels-release truncate_file /var/log/parallels.log . # Synology installation logs synology_dir=Synology day_filter_files_by_pattern /var/log/ "cyber_protect_*.log" "$synology_dir" copy_file_with_parents /var/log/packages/CyberProtectAgent.log $synology_dir # gather aakore units info if [ -x $opt_acronis/aakore ]; then $opt_acronis/aakore units > aakore_units.txt 2>&1 fi if [ -d $opt_var_aakore ]; then mkdir -p ./$opt_var_aakore cp -r $opt_var_aakore ./$opt_var_aakore 2>&1 fi # Gather information about aakore units if [ -x /usr/sbin/aakore ]; then /usr/sbin/aakore units > aakore_units.txt 2>&1 fi # gather site agent units info if [ -x $opt_site_agent/cloud-connection-site-agent-aakore ]; then $opt_site_agent/cloud-connection-site-agent-aakore units > site_agent_aakore_units.txt 2>&1 fi # gather site agent var if [ -d $opt_sa_var_aakore ]; then mkdir -p ./$opt_sa_var_aakore cp -r $opt_sa_var_aakore ./$opt_sa_var_aakore 2>&1 fi # Gather information about tape devices if [ -x /usr/lib/Acronis/ARSM/tapes_info ]; then /usr/lib/Acronis/ARSM/tapes_info tapes_info.txt elif [ -x /bin/tapes_info ]; then /bin/tapes_info tapes_info.txt fi #Get dumps from root folder by pattern if [ "$optimized_mode" -eq "0" ]; then for f in /*.dmp; do [ -r "$f" ] && tar -czf "$(basename $f).tar.gz" "$f"; done fi disk_report_executable="$libdir/BackupAndRecovery/reportst" # Gather disk information if [ -x "$disk_report_executable" ]; then "$disk_report_executable" "$work_dir/disk_report.txt" >/dev/null 2>&1 elif [ -x /bin/reportst ]; then /bin/reportst "$work_dir/disk_report.txt" >/dev/null 2>&1 fi if [ -x /bin/test_pci_parse ]; then /bin/test_pci_parse > test_pci_parse.txt 2>&1 fi license_manager_dir=./license-manager if [ -d $opt_license_manager_db ]; then mkdir -p ./$license_manager_dir day_filter_file $opt_license_manager_log ./$license_manager_dir cp -r $opt_license_manager_db ./$license_manager_dir 2>&1 fi if [ -x /bin/acronis ]; then #netstat for VA and BM /bin/netstat -na > netstat.txt 2>&1 else /bin/netstat -nap > netstat.txt 2>&1 fi if [ -x /usr/bin/vmstat ]; then /usr/bin/vmstat 10 6 > vmstat.txt 2>&1 elif [ -x /bin/vmstat ]; then /bin/vmstat 10 6 > vmstat.txt 2>&1 fi if [ -x /bin/mokutil ]; then /bin/mokutil --list-enrolled > enrolled_keys.txt 2>&1 fi copy_file /bin/autostart find . -type s -print0 | xargs -0 rm -f find . -name preferred\* -print0 | xargs -0 rm -f find . -name masterkey.local -print0 | xargs -0 rm -f find . -name *.sec -print0 | xargs -0 rm -f find . -name *.prv -print0 | xargs -0 rm -f find . -name *.pem -print0 | xargs -0 rm -f find . -name dml_email_configuration.\* -print0 | xargs -0 rm -f find . -name oauth.yml -print0 | xargs -0 rm -f #ABR-359648 and ABR-365119 find . -name rsa.prv -print0 | xargs -0 rm -f find . -name shared.prv -print0 | xargs -0 rm -f mms_user_config="./var/lib/Acronis/BackupAndRecovery/MMS/user.config" if [ -e "$mms_user_config" ]; then rm -f "$mms_user_config" 2>&1 fi # CyberDesktop Agent logs (per-user) # xxx-yyy-capture.log, xxx-yyy-capture.log.# (xxx is user id, yyy is display id) cyberdesktop_agent_dir=cyberdesktop_agent for i in /home/*/.acronis/cyber-desktop-service/ do test -d "$i" || continue user_name="${i#/home/}" user_name="${user_name%/.acronis/cyber-desktop-service/}" mkdir -p "$cyberdesktop_agent_dir/$user_name/" cp "$i"*.log* "$cyberdesktop_agent_dir/$user_name/" done report_progress 95 # delete big files from report if [ "$max_file_size" -gt "0" ]; then echo "Files more than $max_file_size Mb were deleted:" >> ./$optimization_log find $dir -type f -size +$(($max_file_size))M -print0 | xargs -0 -I {} bash -c "echo {} >> ./$optimization_log; rm -rf {}" fi # keep hide_password staff as the last action before tar function hide_password { local file="$1" local secure_info_pattern="(Username|Password|passphrase)" grep -vwE $secure_info_pattern "$file" > "$file.$$" mv -f "$file.$$" "$file" } function hide_password_http_proxy_yaml { local file="$1" sed -e "s| proxy:.*@| proxy:XXXXXX@|" "$file" > "$file.$$" mv -f "$file.$$" "$file" } function hide_password_ocr { local file="$1" # remove password, format "password":"my_password" or empty "password":"" sed -e "s|\"password\":\"[^\"]*\"|\"password\":\"XXXXXX\"|g" "$file" > "$file.$$" mv -f "$file.$$" "$file" } function hide_password_all { local names_list="config etc_config Global.config api_gateway.json" for name in $names_list; do for i in `find . -type f -name $name`; do hide_password "$i" done done for i in `find . -type f -name http-proxy.yaml`; do hide_password_http_proxy_yaml "$i" done for i in `find . -type f -name one_click_recovery.config`; do hide_password_ocr "$i" done } hide_password_all cd ../ message "Report compression started." if [ "$is_dir_mode" -eq "1" ]; then message "Sysinfo collected into '$work_dir'." exit 0 fi tar -cjf "$result_abs_path" ./logs rm -rf ./logs report_progress 100 if [ -f "$result_abs_path" ]; then message "Report file $result_abs_path has been created." exit 0 fi exit 1