Output IPCONFIG report to HTML by PowerShell

$file = "C:\Users\jcr\a.html" $ipconfig=ipconfig /all |%{"$_<br/>"} $body=@" <html> <head> <title>Network Report</title> </head> <body> <h1>IPConfig /All</h1> <pre>$ipconfig</pre> </body> </html> "@ $body | Out-File $file . $file

2019-04-25

Create a job using crontab

To automate tasks or create some monitoring job we can use the older and efficient tool the “CronJob”. For our example, I’ve created a simple script to detect the cache memory and clean it if raise to a condition then send a notification by mail. Library used: exim4 (mail server) or ssmtp (mail server). Both uses the same “mail” command. Script: # grab the buff/cache memory mem="$(free -m | grep 'Mem:' | awk '{print $6}')" if (( $mem > 350 )) then echo 'wooo is more than 250M' echo 3 | sudo tee /proc/sys/vm/drop_caches echo 'cache dropped' echo "Memory buff/cache cleaned last value:" $mem | mail -s "cache_memory" target_mail@local....

2019-04-03