- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- not able to capture remsh outputs in table format
Categories
Company
Local Language
Forums
Discussions
Forums
- Data Protection and Retention
- Entry Storage Systems
- Legacy
- Midrange and Enterprise Storage
- Storage Networking
- HPE Nimble Storage
Discussions
Discussions
Discussions
Forums
Discussions
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
- BladeSystem Infrastructure and Application Solutions
- Appliance Servers
- Alpha Servers
- BackOffice Products
- Internet Products
- HPE 9000 and HPE e3000 Servers
- Networking
- Netservers
- Secure OS Software for Linux
- Server Management (Insight Manager 7)
- Windows Server 2003
- Operating System - Tru64 Unix
- ProLiant Deployment and Provisioning
- Linux-Based Community / Regional
- Microsoft System Center Integration
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Community
Resources
Forums
Blogs
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-11-2012 09:26 AM
11-11-2012 09:26 AM
not able to capture remsh outputs in table format
Hi All,
I am trying to capture date/time from all servers from a centralized server, I can see remsh output on my screen but dont see output in html tabular format, please help, below is the script.
cat ntp3.sh
#!/bin/sh
cd /home/mkb/scripts
echo "<html>" > WWP_TZ.html;
echo "<body>" >> WWP_TZ.html;
echo "<pre>" >> WWP_TZ.html;
echo "<h1> WWP TimeZone Change Report </h1>" >> WWP_TZ.html;
for i in `cat /home/mkb/scripts/HOST`
do
Hostname=$i
T_Z=$(remsh $i echo $TZ)
DateZ=$(remsh $i date +%Z)
DateH=$(remsh $i date)
echo "<tr>" >> WWP_TZ.html ;
echo "<td>" >> WWP_TZ.html ;echo $Hostname ; echo "</td>" >> WWP_TZ.html;
echo "<td>" >> WWP_TZ.html ;echo $T_Z ; echo "</td>" >> WWP_TZ.html;
echo "<td>" >> WWP_TZ.html ;echo $DateZ ; echo "</td>" >> WWP_TZ.html;
echo "<td>" >> WWP_TZ.html ;echo $DateH ; echo "</td>" >> WWP_TZ.html;
echo "</tr>" >> WWP_TZ.html ;
done
echo "</pre>" >> WWP_TZ.html;
echo "</body>" >> WWP_TZ.html;
echo "</html>" >> WWP_TZ.html;
- Tags:
- html
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-11-2012 11:22 AM
11-11-2012 11:22 AM
Re: not able to capture remsh outputs in table format
You don't have any tags to actually define the table itself.
A basic table in html is:
<table>
<tr>
<td>data</td>
<td>more data </td>
</tr>
</table>
You need to add the <table> and </table> tags in the appropriate spot in your script. I think that will help.
For example:
<table>
for i in `cat /home/mkb/scripts/HOST`
do
...
...
...
done
</table>
echo "</pre>" >> WWP_TZ.html;
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-11-2012 12:58 PM - edited 11-12-2012 12:05 PM
11-11-2012 12:58 PM - edited 11-12-2012 12:05 PM
Re: not able to capture remsh outputs in table format
You may want to use here docs to make your script easier to understand:
cat <<EOF > WWP_TZ.html;
<html>
<body>
<pre>
<h1> WWP TimeZone Change Report </h1>
EOF
for i in $(< /home/mkb/scripts/HOST); do
Hostname=$i
T_Z=$(remsh $i echo $TZ)
DateZ=$(remsh $i date +%Z)
DateH=$(remsh $i date)
cat <<EOF >> WWP_TZ.html
<tr>
<td> $Hostname </td>
<td> $T_Z </td>
<td> $DateZ </td>
<td> $DateH </td>
</tr>
EOF
done
cat <<EOF >> WWP_TZ.html
</pre>
</body>
</html>
EOF
- Tags:
- here doc
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-12-2012 07:48 AM - edited 11-12-2012 07:49 AM
11-12-2012 07:48 AM - edited 11-12-2012 07:49 AM
Re: not able to capture remsh outputs in table format
Good morning,
I was looking more at your script and figured out some more issues.
The first is, still, that you do not have the <table> and </table> tags to define the table.
However, your main issue is that you are not redirecting the Hostname, T_Z, DateZ and DateH variables into your file. You are doing an 'echo' but the information is just echoing to the screen and not going into your HTML file.
Here is my modified version of your script:
#!/bin/sh cd /home/mkb/scripts echo "<html>" > WWP_TZ.html echo "<body>" >> WWP_TZ.html echo "<pre>" >> WWP_TZ.html echo "<h1> WWP TimeZone Change Report </h1>" >> WWP_TZ.html echo "<table border=2>" >> WWP_TZ.html echo "<tr>" >> WWP_TZ.html echo "<td>Hostname</td>" >> WWP_TZ.html echo "<td>TZ</td>" >> WWP_TZ.html echo "<td>date +%Z</td>" >> WWP_TZ.html echo "<td>date</td>" >> WWP_TZ.html echo "</tr>" >> WWP_TZ.html for i in $(< /home/mkb/scripts/HOST) do
Hostname=$i T_Z=$(remsh $i echo $TZ) DateZ=$(remsh $i date +%Z) DateH=$(remsh $i date) echo "<tr>" >> WWP_TZ.html echo "<td> $Hostname </td>" >> WWP_TZ.html echo "<td> $T_Z </td>" >> WWP_TZ.html echo "<td> $DateZ </td>" >> WWP_TZ.html echo "<td> $DateH </td>" >> WWP_TZ.html echo "</tr>" >> WWP_TZ.html done echo "</table>" >> WWP_TZ.html echo "</pre>" >> WWP_TZ.html echo "</body>" >> WWP_TZ.html echo "</html>" >> WWP_TZ.html
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-12-2012 12:04 PM
11-12-2012 12:04 PM
Re: not able to capture remsh outputs in table format
>You are doing an 'echo' but the information is just echoing to the screen and not going into your HTML file.
Yes, my here doc would make it obvious. I just happened to fix it without thinking when I converted it.
Also lines can be combined if desired.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-13-2012 08:59 AM
11-13-2012 08:59 AM
Re: not able to capture remsh outputs in table format
Do you mean that your terminal program has a html interpreter included?