Cameron Simpson <[EMAIL PROTECTED]> writes:

> Sure. Put this:
>
>       echo "Your current disc consumption:"
>       du -s $HOME/.
>
> in /etc/profile. However, if they have a lot of files this will take a long time
> and annoy everyone.
>
> | If not
> | Is is possible to displays /home disk space with some welcome message?
>
> Sure:
>
>       echo "Current space utilisation in /home:"
>       df /home
>
> That's much faster, and probably more useful anyway.

How is that more usefull for showing a users usage?

Here is one way to do it <untested so use at your own risk>

Run a cron job each night that logs the users disk usage to a file
with somethin like this

(Assumes all directories under home are users directories and that
you've created a directory at /var/log/usage with 755 permissions)

cat usage.sh
#!/bin/sh

for user in `ls -d /home/*/`;do
   du -sh $user >$user/.usage
   chown $user:$user $user/.usage
done

^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

As root add someting like this to roots crontab:

   30 01 * * * /path/to/usage.sh

Then put something like this in /etc/profile

echo "Your disk usage is:"
cat $HOME/.usage

Each users .usage file will get overwritten with the new info each
day.

If that isn't often enough run the cron job more frequently.



_______________________________________________
Seawolf-list mailing list
[EMAIL PROTECTED]
https://listman.redhat.com/mailman/listinfo/seawolf-list

Reply via email to