Unix shell scripts – Display Logged in users and who is using high CPU percentage
Bash script ini berfungsi untuk menampilkan sedikit informasi mengenai user-user yang baru saja login dan apa yang mereka lakukan.
Source code : loggedin.sh
#! /bin/bash w > /tmp/a echo "Total number of unique users logged in currently" cat /tmp/a| sed '1,2d' | awk '{print $1}' | uniq | wc -l echo "" echo "List of unique users logged in currently" cat /tmp/a | sed '1,2d'| awk '{print $1}' | uniq echo "" echo "The user who is using high %cpu" cat /tmp/a | sed '1,2d' | awk '$7 > maxuid { maxuid=$7; maxline=$0 }; END { print maxuid, maxline }' echo "" echo "List of users logged in and what they are doing" cat /tmp/a
Jalankan : ./loggedin.sh
Total number of unique users logged in currently 1 List of unique users logged in currently tux-kecil The user who is using high %cpu 0.00s tux-kecil ttyp1 118.96.149.36 05:38 0.00s 0.08s 0.00s /bin/bash ./log List of users logged in and what they are doing 09:21:19 up 2 days, 23:37, 1 user, load average: 0.00, 0.00, 0.00 USER TTY FROM LOGIN@ IDLE JCPU PCPU WHAT tux-kecil ttyp1 118.96.149.36 05:38 0.00s 0.08s 0.00s /bin/bash ./log
kalau mau bikin file instaler aplikasi pakai SH gimana yaaaa?