Recently I was heading the System testing and coorddinating UAT for a project. Occasinally I need to manually go unix and run some job. I hate to remember the sequence of those jobs, so I simply create a little tool for myself. It actually can be used for general purposes.

The command sequences are stored in XML files as showed below. The file is loaded in to a Tk::Listbox. Click on a task will show command sequence in a Tk::Text, and double click executes the sequence thru Net::Telnet.

use Net::Telnet; use Tk; use XML::Simple; use strict; use warnings; use constant HOST => "1"; use constant USERNAME => "2"; use constant PASSWORD => "3"; my $tasks = XMLin("command.xml"); my $mw = MainWindow->new(); my $list; $list = $mw->Scrolled("Listbox", yscrollcommand => sub {show_detail($l +ist->curselection())}, -scrollbars=>"e")->pack(-fill => 'x'); $list->bind("<1>", sub {show_detail($list->curselection())}); $list->bind("<Double-1>", sub {doit($list->curselection())}); my $detail = $mw->Scrolled("Text", -width => 40, -height=>10, -scrollb +ars=>"e")->pack(-fill => 'x'); for my $id (0..$#{@{$tasks->{"task"}}}) { $list->insert("end", $tasks->{"task"}->[$id]->{"description"}) +; } MainLoop; sub doit { my $task_id = shift; my $t = new Net::Telnet(timeout => 10, Prompt => '/\[AAUA1\]/' +); $t->open(HOST); $t->login(USERNAME, PASSWORD); my $cmds = $tasks->{"task"}->[$task_id]->{"command"}; for (0..$#{@{$cmds}}) { my @lines = $t->cmd($cmds->[$_]->{"string"}); print @lines; } } sub show_detail { my $task_id = shift; $detail->delete("\@1,1", "end"); my $cmds = $tasks->{"task"}->[$task_id]->{"command"}; for (0..$#{@{$cmds}}) { $detail->insert("end", $cmds->[$_]->{"string"} . "\n"); } }
<tasks> <task description="Publish PO"> <command string="cd ofg" /> <command string="POPublish.ksh 0" /> <command string="POExtractDriver.ksh TRICEPS 0" /> </task> <task description="Receiving PO"> <command string="cd ofg" /> <command string="POSubscribeDriver.ksh Triceps 0" /> <command string="POUpdateDriver.ksh" /> </task> <task description="Publish Orders"> <command string="cd ofg" /> <command string="POEvent.ksh" /> <command string="POPublish.ksh" /> </task> <task description="Publish Store Orders"> <command string="cd ofg/mcom" /> <command string="MCOMTricepsWriter.ksh" /> </task> <task description="Complete Store Orders"> <command string="cd ofg/mcom" /> <command string="TricepsMCOMWriter.ksh" /> </task> </tasks>

In reply to An operator's desk on my PC by pg

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.