 |
Java |
Informato
Registered: Apr 2005
Posts: 62 (0.01 al dì)
Location: Bergamo
Corso: informatica triennale
Anno: 2008
Time Online: 20:19:44 [...]
Status: Offline
Edit | Report | IP: Logged |
per ogni utente trovare il processo che occupa piu spazio in memoria
#!/bin/sh
echo $(cat /etc/passwd | cut -d ' ' -f 3) > utenti.txt
echo "" > processi.txt
for uid in $(cat utenti.txt);do
echo "$uid -> $(ps -axl| tr -s ' ' ' ' | cut -d ' ' -f 4, 8-15 | grep "^$uid"|cut -d ' ' -f 2-8 | sort -n | tail -1)" >> processi.txt
done;
cat processi.txt
Trovare i tre utenti che occupano piu spazio sul sistema
#!/bin/sh
echo "" > utentisize.txt
echo $(cat /etc/passwd | cut -d ':' -f 3) > utenti.txt
for uid in $(cat utenti.txt);do
echo $(find / -type f -user $uid | xargs du -s | cut -f 1) > file utente.txt
SOMMA=0
for dim in $(cat fileutente.txt);do
SOMMA=$(expr $SOMMA + $dim)
done;
echo "$uid $SOMMA" >> utentisize.txt
done;
cat utentisize.txt | sort +1 | tail -3
__________________
io Sofort e te che sei? un pupazzo?
Last edited by Java on 15-01-2009 at 10:18
|