/[SysIface]/templates/commands.html.epl
This is repository of my old source code which isn't updated any more. Go to git.rot13.org for current projects!
ViewVC logotype

Annotation of /templates/commands.html.epl

Parent Directory Parent Directory | Revision Log Revision Log


Revision 7 - (hide annotations)
Wed Jun 17 11:28:12 2009 UTC (14 years, 10 months ago) by dpavlin
File size: 699 byte(s)
- run commands with file cache in var/hostname/command
- run commands on all hosts in etc/hosts and display table out of it

1 dpavlin 6 % my $self = shift;
2     % my $hostname = $self->param('hostname');
3    
4     <form method=get>
5     <label for=hostname>hostname
6     <input name=hostname type=text value="<%= $hostname %>">
7     </label>
8     <input type=submit value=run>
9     </form>
10    
11     <h1><%= $hostname %></h1>
12    
13     % foreach my $cmd ( @{ $self->stash('commands') } ) {
14     % if ( $cmd =~ s{^(#+)\s*}{} ) {
15     % my $l = length($1) + 1;
16     %= "<h$l>$cmd</h$l>"
17     % } else {
18     % my $run = $hostname ? "ssh $hostname $cmd" : $cmd;
19     <b><tt><%= $cmd %></tt></b><br>
20     <pre><%= `$run` %></pre>
21 dpavlin 7 <table>
22     <tr><th colspan=2><%= $cmd %></td><tr>
23     % foreach my $run ( $self->run( $cmd ) ) {
24     <tr>
25     <th><%= $run->{hostname} %></th>
26     <td>
27     <pre><%= $run->{out} %></pre>
28     </td>
29     </tr>
30     % }
31     </table>
32 dpavlin 6 % }
33     % }

  ViewVC Help
Powered by ViewVC 1.1.26