LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Software (https://www.linuxquestions.org/questions/linux-software-2/)
-   -   inserting command output in specific html table (https://www.linuxquestions.org/questions/linux-software-2/inserting-command-output-in-specific-html-table-4175576788/)

aristosv 04-05-2016 11:57 PM

inserting command output in specific html table
 
I use the following commands in a bash script, to output the CPU and disk usage on a computer.

I would like to import this output directly in an HTML file with tables.

How can I get the ouput of these commands to go in a specific table, as shown in the HTML code below?

Code:

echo $[100-$(vmstat|tail -1|awk '{print $15}')]'%'
df -h /dev/sda1 | awk 'NR>1{print $5}'

Code:

<html>
<head>
<title>Report</title>
</head>
<body>
<table>
        <tr>
                <td></td>
                <td>CPU Usage</td>
                <td>Disk Usage</td>
        </tr>
        <tr>
                <td>Computer1</td>
                <td></td>
                <td></td>
        </tr>
        </table>

</body>
</html>


ondoho 04-06-2016 03:19 PM

are you asking how to write a shell script that will produce an html file with the desired output?
or do you want to use this as a live web page?

the former is trivial, the latter will require server-side scripting, most probably php.
there's ample php documentation, tutorials and whatnot in the wild, wild web.


All times are GMT -5. The time now is 12:14 AM.