System Information Script

This reports a cron job as SSH pre-MOTD at a specified interval that which collects system info.

As root, enter:

EDITOR=nano

Then you can safely enter:

crontab -e

Voila! crontab with a human-usable text editor.

The Crontab...

Paste this into the crontab and press Ctrl-x followed by typing yes to confirm and pressing enter to finalize.

*/2 * * * * /usr/local/bin/sys_stat.sh

And the script...

(As root!)

nano -wc /usr/local/bin/sys_stat.sh

#!/bin/bash
CPUTIME=$(ps -eo pcpu | awk 'NR>1' | awk '{tot=tot+$1} END {print tot}')
CPUCORES=$(cat /proc/cpuinfo | grep -c processor)
echo "
System Summary (collected `date`)

 - CPU Usage (average)       = `echo $CPUTIME / $CPUCORES | bc`%
 - Memory free (real)        = `free -m | head -n 2 | tail -n 1 | awk {'print $4'}` Mb
 - Memory free (cache)       = `free -m | head -n 3 | tail -n 1 | awk {'print $3'}` Mb
 - Swap in use               = `free -m | tail -n 1 | awk {'print $3'}` Mb
 - System Uptime             =`uptime`
 - Public IP                 = `dig +short myip.opendns.com @resolver1.opendns.com`
 - Disk Space Free           = `df -h / | awk '{ a = $4 } END { print a }'`

" > /etc/motd

Enjoy :)

Edit or resize any image by clicking the image preview
Edit any image by touching the image preview
You can add more images from your computer or add image URLs.
You can add more images from your device, take a picture or add image URLs.
Uploading 0 image (0% complete)
The queue is being uploaded, it should take just a few seconds to complete.
Upload complete
Uploaded content added to . You can create a new album with the content just uploaded.
Uploaded content added to .
You can create an account or sign in to save this content into your account.
No image have been uploaded
Some errors have occured and the system couldn't process your request.
    or cancelcancel remaining
    Note: Some images couldn't be uploaded. learn more
    Check the error report for more information.
    JPG PNG BMP GIF 2 MB