[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[cobalt-users] SecureCRT Users -- Script(s) for RaQ4



I put together a little script for SecureCRT that automates ls -l on the
/home/sites directory.

The entire script is pasted at the bottom of this message.   To use it, just
copy the script text, paste it into notepad, save it to the \scripts folder for
SecureCRT *with* a ".vbs" extension, and then run it from the "Scripts"
menu within SecureCRT -- you *do* need to be logged  into your server,
of course...

What you can do with it:

1.  Leave "ALL" in the prompt and get a complete site list

2.  Enter anything else in the prompt that will work with "grep" to
     get a refined list:

     *  host.domain.tld will result in just that site being displayed
     * .com or .net or .org, etc. will list all respective sites with
        those tld's
     * domain or even a fragment of the domain will list any site(s)
        [.net, .com, etc.] that are part of that domain

3.  Assign it to a shortcut key in keymapper and get one-keystroke
     access to the command

The best use for this is looking up a site number quickly for whatever
domain.  I have another one here that runs tail -f and another that is in the
works to automatically setup a cgi-sys directory for sites with FrontPage
extensions on them.  It's really turning into a nice little collection.

If anybody has any feedback or suggestions for commands that would really be
worth including in something like this, drop me a note and I'll add them in as
time permits (off-list might be best).

If there is enough positive feedback and interest, I'll put them all in a zip
file somewhere for download.  Thanks in advance for your feedback.

Note:  Your email client might word-wrap one or two lines below.  You will
want to get rid of those carriage returns before you run this, probably.


rks

=========== Script Follows ===========
# $language = "VBScript"
# $interface = "1.0"

Sub Main

Dim strSearch, strSearchString, strSearchPrompt

crt.Screen.Synchronous = True
strSearchString = "ls -l --color /home/sites "
strSearchPrompt = "Enter any valid parameter (grep) to constrain your" & vbCrLf
strSearchPrompt = strSearchPrompt & "site list, or " & Chr(34) & "ALL" & Chr(34)
& " to view all sites..."

strSearch = crt.Dialog.Prompt(strSearchPrompt, "Site List Lookup Tool", "ALL",
False)

Select Case strSearch
    Case "ALL"
           strSearchString = Trim(strSearchString)
    Case ""
           Exit Sub
    Case Else
           strSearchString = strSearchString & "| grep " & strSearch
End Select

crt.Screen.SendSpecial "MENU_CLEAR_SCREEN"
crt.Screen.SendSpecial "MENU_CLEAR_SCROLLBACK"
crt.Screen.Send(strSearchString & vbCR )
crt.Screen.WaitForStrings "]#", "]$"
crt.Screen.Synchronous = False

End Sub