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

📄 daily

📁 早期freebsd实现
💻
字号:
#!/bin/sh -##	@(#)daily	8.2 (Berkeley) 1/25/94#PATH=/bin:/usr/bin:/sbin:/usr/sbin:/usr/local/binhost=`hostname`echo "Subject: $host daily run output"bak=/var/backupsecho ""echo "Removing scratch and junk files:"if [ -d /tmp ]; then	cd /tmp && {	find . -type f -atime +3 -exec rm -f -- {} \;	find . ! -name . -type d -mtime +1 -exec rmdir -- {} \; \	    >/dev/null 2>&1; }fiif [ -d /var/tmp -a "X$CLEANVARTMP" = X1 ]; then	cd /var/tmp && {	find . ! -name . -atime +7 -exec rm -f -- {} \;	find . ! -name . -type d -mtime +1 -exec rmdir -- {} \; \	    >/dev/null 2>&1; }fiif [ -d /scratch ]; then	cd /scratch && {	find . ! -name . -atime +1 -exec rm -f -- {} \;	find . ! -name . -type d -mtime +1 -exec rmdir -- {} \; \	    >/dev/null 2>&1; }fiif [ -d /var/preserve ]; then	cd /var/preserve && {	find . ! -name . -mtime +7 -exec rm -f -- {} \; ; }fiif [ -d /var/rwho ] ; then	cd /var/rwho && {	find . ! -name . -mtime +7 -exec rm -f -- {} \; ; }ficd /tmpTMP=daily.$$find / \( ! -fstype local -o -fstype rdonly \) -a -prune -o \	-name 'lost+found' -a -prune -o \	-name '*.core' -a -print -o \	\( -name '[#,]*' -o -name '.#*' -o -name a.out \	   -o -name '*.CKP' -o -name '.emacs_[0-9]*' \) \		-a -atime +3 -a -exec rm -f -- {} \; -a -print > $TMPecho ""echo "Possible core dumps:"egrep '\.core' $TMPecho ""echo "Deleted files:"egrep -v '\.core' $TMPrm -f $TMP	msgs -cif [ -f /etc/news.expire ]; then	/etc/news.expirefiecho ""echo "Purging accounting records:"mv /var/account/acct.2 /var/account/acct.3mv /var/account/acct.1 /var/account/acct.2mv /var/account/acct.0 /var/account/acct.1cp /var/account/acct /var/account/acct.0sa -s > /dev/null# If ROOTBACKUP is set to 1 in the environment, and# if filesystem named /altroot is type ufs, on /dev/* and mounted "xx",# use it as a backup root filesystem to be updated daily.[ "X$ROOTBACKUP" = X1 ] && {	rootdev=`awk '$2 == "/" && $1 ~ /^\/dev\// && $3 == "ufs" && \	    $4 == "rw" \		 { print substr($1, 6) }' < /etc/fstab`	rootbak=`awk '$2 == "/altroot" && $1 ~ /^\/dev\// && $3 == "ufs" && \	    $4 == "xx" \		{ print substr($1, 6) }' < /etc/fstab`	[ X$rootdev != X -a X$rootbak != X ] && {		sync		echo ""		echo "Backing up root filesystem:"		echo "copying /dev/r$rootdev to /dev/r$rootbak"		dd if=/dev/r$rootdev of=/dev/r$rootbak bs=16b seek=1 skip=1 \			conv=noerror,sync		fsck -y /dev/r$rootbak	}}echo ""echo "Running calendar:"calendar -aecho ""echo "Rotating mail log:"cd /var/logrm -f maillog.7if [ -f maillog.6 ]; then mv -f maillog.6  maillog.7; fiif [ -f maillog.5 ]; then mv -f maillog.5  maillog.6; fiif [ -f maillog.4 ]; then mv -f maillog.4  maillog.5; fiif [ -f maillog.3 ]; then mv -f maillog.3  maillog.4; fiif [ -f maillog.2 ]; then mv -f maillog.2  maillog.3; fiif [ -f maillog.1 ]; then mv -f maillog.1  maillog.2; fiif [ -f maillog.0 ]; then mv -f maillog.0  maillog.1; fimv -f maillog maillog.0cp /dev/null maillogchmod 644    maillogkill -1 `cat /var/run/syslog.pid`cd /if [ -d /var/spool/uucp -a -f /etc/uuclean.daily ]; then	echo ""	echo "Cleaning up UUCP:"	echo /etc/uuclean.daily | su daemonfiecho ""echo ""echo "Checking subsystem status:"echo ""echo "disks:"env BLOCKSIZE=1k dfecho ""dump Wecho ""echo ""echo "mail:"mailqif [ -d /var/spool/uucp ]; then	echo ""	echo "uucp:"	uusnapfiecho ""echo "network:"netstat -iecho ""ruptimeecho ""echo "Checking filesystems:"fsck -n | grep -v '^\*\* Phase'echo ""if [ -f /etc/Distfile ]; then	echo "Running rdist:"	if [ -d /var/log/rdist ]; then		logf=`date | awk '{printf "%s.%s.%s", $6, $2, $3}'`		rdist -f /etc/Distfile 2>&1 | tee /var/log/rdist/$logf	else		rdist -f /etc/Distfile 	fifish /etc/security 2>&1 | mail -s "$host daily insecurity output" root

⌨️ 快捷键说明

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