Skip to content
master
Switch branches/tags
Code

Latest commit

 

Git stats

Files

Permalink
Failed to load latest commit information.
Type
Name
Latest commit message
Commit time
 
 
 
 
 
 
 
 
 
 
 
 

How to run command:

sysinfo.sh -c cmd_list -o output.html

-c cmd_list is the template to use (see template setup below) [required]

-o output.html is the html output file (default: sysinfo.html) [optional]

run with -h option to display help menu [optional]

Setup command template:

Source bash functions
source /$(pwd)/functions
Create a heading
heading_start "Example Heading"
Create a sub heading with command output

Start with sub heading

sub_start "Example sub heading"

Now add the command to show

run_command "route -n"

Surround commands with double quotes.

Complete and finish headings

Close sub heading

sub_end

Close heading

heading_end

End result would like something like this:

source /$(pwd)/functions

heading_start "Example Heading"

  sub_start "Example sub heading"

    run_command "route -n"

  sub_end

heading_end

NB: indention is not required, just makes it look nicer

HTML output: Example Screenshot

You can also create nested sub headings

source /$(pwd)/functions

heading_start "Example Heading"

  sub_start "Example sub heading"

    sub_start "Nested sub heading 1"

    run_command "route -n"

    sub_end
    
    sub_start "Nested sub heading 2"

    run_command "ifconfig -a"

    sub_end

  sub_end

heading_end

Example Screenshot

This script also supports more complicated commands (see below)

Advanced Example 1:
sub_start "Advanced Example 1"
  run_command "[ -f /etc/hosts ] && echo 'File Exist' && grep 'local' /etc/hosts | wc -l"
sub_end
Advanced Example 2:
sub_start "Advanced example 2"
  ifconfig | grep 'eth\|lo' | cut -c1-4 >interfaces.tmp
  while read line
  do
    run_command "ethtool $line"
  done <interfaces.tmp
  rm -f interfaces.tmp
sub_end
Loop Example:
sub_start "Loop Example"
  for i in {1..5}
  do
    run_command echo "$i"
  done
sub_end

About

This simple script uses command driven templates and creates a snapshot of system information and outputs to a html file.

Topics

Resources

License

Releases

No releases published

Packages

No packages published

Languages