Re: Maintenance Scripts

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



try this:

Thom Paine wrote:

I have been playing with maintenance scripts and would like a hand with
making a nightly one.

Basically I would like a report of the hard drives free space, a report
of a nightly virus scan, have it delete any temp files, and that sort of
thing. I've been thinking on getting it to email me a complete report
after it is finished up, and I'm not sure how to tie it all together.

What I have so far is this.

#!/bin/bash
# Maintenance Script
# Find and delete temp files
cd /home
find -name *.tmp -exec rm -f {} \;
find -name *.TMP -exec rm -f {} \;
find -name *.bak -exec rm -f {} \;
# Report each users home folder size
cd /home
du -c -h --max-depth=1 > /root/homesize.txt


consider using one file and just append to it, ie:
echo "Report each users home folder size" > /root/summary.txt

du -c -h --max-depth=1 >> /root/summary.txt


# Disk Free List

echo "Disk Free List" >> /root/summary.txt

df -h >> /root/summary.txt


mail -s "summary report" emailid@xxxxxxxxxx < /root/summary.txt




Any comments or help would be appreciated. I'm a script rookie and am
working away at it slowly.

Thanks.

-=/>Thom








-- Shrike-list mailing list Shrike-list@xxxxxxxxxx https://www.redhat.com/mailman/listinfo/shrike-list

[Index of Archives]     [Fedora Users]     [Centos Users]     [Kernel Development]     [Red Hat Install]     [Red Hat Watch]     [Red Hat Development]     [Red Hat Phoebe Beta]     [Yosemite Forum]     [Fedora Discussion]     [Gimp]     [Stuff]     [Yosemite News]

  Powered by Linux