⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 500.daily

📁 Mac OS X 10.4.9 for x86 Source Code crontabs 实现源代码
💻 DAILY
字号:
#!/bin/sh -##	@(#)daily	8.2 (Berkeley) 1/25/94#PATH=/bin:/usr/bin:/sbin:/usr/sbin:/usr/local/binhost=`hostname -s`bak=/var/backupsecho ""echo "Removing scratch and junk files:"if [ -d /var/rwho ] ; then    cd /var/rwho && {    find . ! -name . -mtime +7 -exec rm -f -- {} \; ; }fi# Clean up junk files.#find / \( ! -fstype local -o -fstype rdonly \) -a -prune -o \#       \( -name '[#,]*' -o -name '.#*' -o -name a.out -o -name '*.core' \#	  -o -name '*.CKP' -o -name '.emacs_[0-9]*' \) \#	       -a -atime +3 -exec rm -f -- {} \;# Clean up NFS turds.  May be useful on NFS servers.#if [ "${host}" != "localhost" ]; then#    find / -name .nfs\* -mtime +7 -exec rm -f -- {} \; -o -fstype nfs -prune#fiif [ -d /tmp ]; then    cd /tmp && {    find . -fstype local -type f -atime +3 -ctime +3 -exec rm -f -- {} \;    find -d . -fstype local ! -name . -type d -mtime +1 -exec rmdir -- {} \; \	>/dev/null 2>&1; }fiif [ -d /var/spool/fax ]; then    echo ""    echo "Removing scratch fax files"    cd /var/spool/fax && \    find . -type f -name '[0-9]*.[0-9][0-9][0-9]' -mtime +7 -delete >/dev/null 2>&1;fi# remove system messages older than 21 daysmsgs -cif [ -f /var/account/acct ] ; then    if [ -x /usr/bin/gzip ]; then gzext=".gz"; else gzext=""; fi    echo ""    echo "Gathering accounting statistics:"    cd /var/account    if [ -f "acct.2${gzext}" ] ; then mv -f "acct.2${gzext}" "acct.3${gzext}" ; fi    if [ -f "acct.1${gzext}" ] ; then mv -f "acct.1${gzext}" "acct.2${gzext}" ; fi    if [ -f "acct.0${gzext}" ] ; then mv -f "acct.0${gzext}" "acct.1${gzext}" ; fi    cp -pf acct acct.0    if [ -x /usr/bin/gzip ]; then gzip -9 acct.0; fi    sa -s > /dev/nullfiif [ -d /var/db/netinfo ]; then    echo ""    echo "Backing up NetInfo data"    cd /var/db/netinfo    for domain in *.nidb; do	domain=$(basename $domain .nidb)	server=`nicl -t localhost/$domain -statistics | grep tag | awk '{print $3}'`	if [ $server = master ] ; then nidump -r / -t localhost/$domain > $bak/$domain.nidump; fi    donefiecho ""echo "Checking subsystem status:"echo ""echo "disks:"df -k -lecho ""dump Wif [ -d /var/spool/mqueue ]; then	echo ""	echo "mail:"	mailqfiecho ""echo "network:"netstat -iecho ""if [ -d /var/rwho ] ; then	ruptimefiecho ""printf %s "Rotating log files:"cd /var/logfor i in system.log; do    if [ -f "${i}" ]; then	printf %s " ${i}"	if [ -x /usr/bin/gzip ]; then gzext=".gz"; else gzext=""; fi	if [ -f "${i}.6${gzext}" ]; then mv -f "${i}.6${gzext}" "${i}.7${gzext}"; fi	if [ -f "${i}.5${gzext}" ]; then mv -f "${i}.5${gzext}" "${i}.6${gzext}"; fi	if [ -f "${i}.4${gzext}" ]; then mv -f "${i}.4${gzext}" "${i}.5${gzext}"; fi	if [ -f "${i}.3${gzext}" ]; then mv -f "${i}.3${gzext}" "${i}.4${gzext}"; fi	if [ -f "${i}.2${gzext}" ]; then mv -f "${i}.2${gzext}" "${i}.3${gzext}"; fi	if [ -f "${i}.1${gzext}" ]; then mv -f "${i}.1${gzext}" "${i}.2${gzext}"; fi	if [ -f "${i}.0${gzext}" ]; then mv -f "${i}.0${gzext}" "${i}.1${gzext}"; fi        if [ -f "${i}" ]; then              touch "${i}.$$" && chmod 640 "${i}.$$" && chown root:admin "${i}.$$"              mv -f "${i}" "${i}.0" && mv "${i}.$$" "${i}" && if [ -x /usr/bin/gzip ]; then 		gzip -9 "${i}.0"; fi        fi    fidoneif [ -f /var/run/syslog.pid ]; then kill -HUP $(cat /var/run/syslog.pid | head -1); fiecho ""# Prune the main syslog output file (/var/log/asl.log)# Delete all messages after 7 days (-k Time lt -7d)# Delete Warning (Level 4) and above after 3 days (-k Time lt -3d -k Level ge 4)# Delete Info (Level 6) and above after 1 day (-k Time lt -1d -k Level ge 6)syslog -p -k Time lt -7d -o -k Time lt -3d -k Level ge 4 -o -k Time lt -1d -k Level ge 6if [ -f /etc/daily.local ]; then    echo ""    echo "Running daily.local:"    sh /etc/daily.localfiif [ -f /etc/security ]; then    echo ""    echo "Running security:"    sh /etc/security 2>&1 | sendmail rootfi

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -