Server IP : 85.214.239.14 / Your IP : 3.15.31.168 Web Server : Apache/2.4.62 (Debian) System : Linux h2886529.stratoserver.net 4.9.0 #1 SMP Tue Jan 9 19:45:01 MSK 2024 x86_64 User : www-data ( 33) PHP Version : 7.4.18 Disable Function : pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wifcontinued,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_get_handler,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority,pcntl_async_signals,pcntl_unshare, MySQL : OFF | cURL : OFF | WGET : ON | Perl : ON | Python : ON | Sudo : ON | Pkexec : OFF Directory : /proc/2/task/2/root/usr/lib/sysstat/ |
Upload File : |
#!/bin/bash # /usr/lib/sysstat/sa2 # (C) 1999-2022 Sebastien Godard (sysstat <at> orange.fr) # #@(#) sysstat-12.6.1 #@(#) sa2: Write a daily report # S_TIME_FORMAT=ISO ; export S_TIME_FORMAT prefix=/usr exec_prefix=${prefix} SA_DIR=/var/log/sysstat SYSCONFIG_DIR=/etc/sysstat SYSCONFIG_FILE=sysstat HISTORY=7 COMPRESSAFTER=10 ZIP="xz" UMASK=0022 ENDIR= DELAY_RANGE=0 # Read configuration file, overriding variables set above [ -r ${SYSCONFIG_DIR}/${SYSCONFIG_FILE} ] && . ${SYSCONFIG_DIR}/${SYSCONFIG_FILE} umask ${UMASK} # Wait for a random delay if requested if [ ${DELAY_RANGE} -gt 0 ] then RANDOM=$$ DELAY=$((${RANDOM}%${DELAY_RANGE})) sleep ${DELAY} fi [ -d ${SA_DIR} ] || SA_DIR=/var/log/sysstat # if YESTERDAY=no then today's summary is generated if [ x$YESTERDAY = xno ] then DATE_OPTS= else DATE_OPTS="--date=yesterday" fi if [ ${HISTORY} -gt 28 ] then DATE=`date ${DATE_OPTS} +%Y%m%d` else DATE=`date ${DATE_OPTS} +%d` fi CURRENTFILE=sa${DATE} CURRENTRPT=sar${DATE} RPT=${SA_DIR}/${CURRENTRPT} DFILE=${SA_DIR}/${CURRENTFILE} if [ -z "${ENDIR}" ]; then ENDIR=${exec_prefix}/bin fi [ -f "${DFILE}" ] || exit 0 cd ${ENDIR} if [ x${REPORTS} != xfalse ] then ${ENDIR}/sar.sysstat "$@" -f ${DFILE} > ${RPT} fi SAFILES_REGEX='/sar?[0-9]{2,8}(\.(Z|gz|bz2|xz|lz|lzo))?$' find "${SA_DIR}" -type f -mtime +${HISTORY} \ | grep -E "${SAFILES_REGEX}" \ | xargs rm -f UNCOMPRESSED_SAFILES_REGEX='/sar?[0-9]{2,8}$' find "${SA_DIR}" -type f -mtime +${COMPRESSAFTER} \ | grep -E "${UNCOMPRESSED_SAFILES_REGEX}" \ | xargs -r "${ZIP}" > /dev/null exit 0