[cs615asa] ec2_backup

Paul-Anthony Dudzinski pdudzins at stevens.edu
Wed Mar 19 20:07:07 EDT 2014


Hello,
I was wondering how people were handling the error checking around finding
the size of the file?

We are using bash and I was wondering how other people were making their
script react to files which the user should have no access to? For instance
if you are to calculate the size on / and your user doesnt have access to
say:


du: cannot read directory `./var/spool/postfix/trace': Permission denied
du: cannot read directory `./var/spool/postfix/maildrop': Permission denied
du: cannot read directory `./var/spool/postfix/corrupt': Permission denied
du: cannot read directory `./var/spool/postfix/hold': Permission denied
du: cannot read directory `./var/spool/postfix/flush': Permission denied
du: cannot read directory `./var/spool/postfix/saved': Permission denied
du: cannot read directory `./var/spool/postfix/private': Permission denied
du: cannot read directory `./var/spool/postfix/bounce': Permission denied
du: cannot read directory `./var/spool/cron/crontabs': Permission denied
du: cannot read directory `./var/spool/cron/atspool': Permission denied

Do you ignore these files?
Do you create a list of the files that are actually able to be read and
executed by the user running the script?
Further more should the script fail if it encounters a file or directory
that it does not have access rights to?

When I ran the following commands to see how big the file system was I get
mixed answers like so:

du -sb /

140800429555376 .


df -B1
pdudzins at rainman:/$ df -B1
Filesystem                                            1B-blocks        Used
  Available Use% Mounted on
/dev/xvda2                                          31706836992 13803315200
16292909056  46% /


Any thoughts as to how to accurately calculate the size? du seems to be
more accurate but takes forever and puts out a lot of garbage, not to
mention it is not clear from the man page whether it adds the size of
restricted files to the total (I am guessing no).
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.stevens.edu/mailman/private/cs615asa/attachments/20140319/cdc04cb6/attachment.html>


More information about the cs615asa mailing list