hyun.psd; gzuncompress
|
Server IP : 173.236.192.202 / Your IP : 216.73.216.85 Web Server : Apache System : Linux iad1-shared-e1-03 6.6.49-grsec-jammy+ #10 SMP Thu Sep 12 23:23:08 UTC 2024 x86_64 User : andfor18 ( 14551322) PHP Version : 7.4.33 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : ON Directory (0755) : /etc/cron.daily/ |
| [ Home ] | [ C0mmand ] | [ Upload File ] | [ Lock Shell ] | [ Logout ] |
|---|
#!/bin/sh # The default Debian ntp.conf enables logging of various statistics to # the /var/log/ntpstats directory. The daemon automatically changes # to a new datestamped set of files at midnight, so all we need to do # is delete old ones, and compress the ones we're keeping so disk # usage is controlled. statsdir=$(cat /etc/ntp.conf | grep -v '^#' | sed -nr 's/^statsdir[[:space:]]+([^[:space:]]+).*$/\1/p') if [ -n "$statsdir" ] && [ -d "$statsdir" ]; then # only keep a week's depth of these. Delete only files exactly # within the directory and do not descend into subdirectories # to avoid security risks on platforms where find is not using # fts-library. find "$statsdir" -maxdepth 1 -type f -name "*stats*" -mtime +7 -delete # compress whatever is left to save space but make sure to really # do it only in the expected directory. cd "$statsdir" || exit 1 ls -d -- *stats.???????? > /dev/null 2>&1 if [ $? -eq 0 ]; then # Note that gzip won't compress the file names that # are hard links to the live/current files, so this # compresses yesterday and previous, leaving the live # log alone. We suppress the warnings gzip issues # about not compressing the linked file. gzip --best --quiet -- *stats.???????? return=$? case $return in 2) exit 0 # squash all warnings ;; *) exit $return # but let real errors through ;; esac fi fi