title: script to monitor system information: date and time, CPU usage and memory
body: <p>Through linux, I am trying to make a shell script called monitornsusystem.sh that will append system related information to the file: systemstatus.log. The system information I need to append is: current date and time, CPU utilization as a percentage and system memory in use as a percentage. I can get all the right information from individual commands but when I put them together in a script, it just displays what's in the parenthesis, but it doesn't run any of the commands. </p>
  
  <pre><code>#!/bin/bash
  sysstat=echo “date +'%d/%m/%Y %H:%M:%S' \
  | echo $[100-$(vmstat 1 2|tail -1|awk '{print $15}’)]% \
  | free \
  | grep Mem \
  | awk '{print $3/$2 * 100.0}’” &gt;&gt; systemstatus.log
  </code></pre>