Script to automate tasks

Hello

I'm looking to automate certain functions in a web application.

Works as a toggle on a Cisco 3550 switch interfaces.

Anyone know if there are good scripts, or any examples to help me get started?

Perpaal,

Here are examples of scripts that stops at an interface and connects to the session in a directory.

File1-IP-list - contains a list of IP addresses that you want to run the script

File2 - ssh.sh - reads the IP list and run file3 which is enableint script

File3 - enableint.sh - script to stop an interface

Deliver files ssh.sh and enableint.sh as executable with chmod + x and you just run. SSH.sh

File1-IP-list

10.10.1.1

10.2.3.2

File2 - ssh.sh

#! / bin/bash

while reading ipadd

do

#echo $ipadd

export ipadd

./enableint.sh $ipadd

fact<>

File3 - enableint.sh

#! / usr/bin/wait f

the value of timeout 20

the IPaddress value [lindex $argv 0]

the value of username "username".

set password 'password '.

set the directory/home/Desktop/logs

Log_file - a $Directory/session_$ IPaddress.log

send_log "# / START-SSH-SESSION / IP: $IPaddress @ [exec date] # \r.

spawn ssh-o 'StrictHostKeyChecking no' $Username@$IPaddress

expect to "* assword:

Send "$Password."

expect to ' # '.

Send "conf t".

' expect' (config) #

Send "int g0/0".

wait "(config-if) ' # '"

Send "shut\r."

wait "(config-if) ' # '"

Send "exit".

' expect' (config) #

Send "exit".

expect to ' # '.

Send "wr mem".

expect to ' # '.

Send "exit\r".

sleep 1

send_log ' \r###/END-SSH-SESSION / IP: $IPaddress @ [exec date] # \r.

output

Siddhartha

Tags: Cisco Network

Similar Questions

  • Script to automatically load issue.

    Is there a way to get my Script to automatically load and placed in the menu where the plugin? Maybe just before the Help menu.  I have a markzware plugin that is on the menu and I just click on that and go from there.  It would be nice to have this script up there too.  Is there a way to get there?

    example:

    var

    myEventListener = app.eventListeners.item ("xx");

    If (! myEventListener.isValid) {}

    myEventListener = app.addEventListener ("onInvoke", doJob);

    myEventListener.name = "xx";

    }

    function doJob() {}

    your main function

    }

  • How to run 'Save as optimized' in a javascript script to automate the optimization of PDF.

    How to run 'Save as optimized' in a javascript script to automate the optimization of the pdf?

    In can't find if this function exists even in javascript, because the API reference is a dead link:

    DC Acrobat SDK Documentation

    This is the good link: Adobe - Adobe Acrobat SDK license agreement | Adobe Developer Connection

    But just to make you save time, you can not do with JS directly. You can probably trigger the menu item he does, but then you still need to interact with it manually.

  • Script to automatically calculate answers to the questions of the option button?

    Hello

    Anyone know if its possible / how to write a script to automatically count the responses of the radio buttons?

    For example, I have a form with 14questions, where the answers are either "Yes" 'Unknown' and 'No' - I used for each question radio buttons.

    At the bottom of the form, I want it to be automatically calculate how much 'yes' 'unknown' and 'No' responses there. (ie. a text box that displays the number of 'Yes', another area of text that displays the number of 'No'... etc)

    Can someone help me with this?

    Thank you so much

    OK, for the text field that counts the groups of numbers with the Yes option radio button is selected, you can use code like:

    // Custom Calculate script for text field
    (function () {
    
        // Initialize counter
        var sum = 0;
    
        // Loop through the fields
        // and increment the counter for each Yes value
        for (var i = 1; i < 15; i += 1) {
            if (getField("Question " + i).value === "Yes") {
                sum += 1;
            }
        }
    
        // Set the value of this field to the sum
        event.value = sum;
    
    })();
    

    Do the same for other areas, but change the 'yes' in the code above to the appropriate string, either 'No' or 'Unknown'.

    It would make sense to convert this to a function in a script at the level of the document, something like:

    // Document-level function
    var radioButtonValueCount = function (sVal) {
    
        // Initialize counter
        var sum = 0;
    
        // Loop through the fields
        // and increment the counter for each sVal value
        for (var i = 1; i < 15; i += 1) {
            if (getField("Question " + i).value === sVal) {
                sum += 1;
            }
        }
    
        // Set the value of the field that called this function to the sum
        event.value = sum;
    
    }
    

    You would then call it like that in the case of calculating a text field that counts the number of selections of Yes:

    // Set this field to the number of Yes selections
    radioButtonValueCount("Yes");
    

    Do the same for Dummies and unknown fields.

  • How to automate tasks in CS4?

    I looked through several guides to automate tasks in CS4. They say perform various tasks in the form of the Action, but none of them tell me how to get to the Action screen and I don't know how.

    I want to automate the application of a few steps in the process. How would I do this in PS CS4?

    To get the Panel actions to appear, go to window > Actions.

    Start with the help of cs4 manual and also google logging actions in photoshop.

    http://help.Adobe.com/en_US/Photoshop/11.0/WSfd1234e1c4b69f30ea53e41001031ab64-7451a.html

    If you give an example of something you want to automate, we could probably help.

    MTSTUNER

  • Path to script and automate the vmkfstools command?

    Very long story short, running vSphere 5, I need a way to execute the command 'vmkfstools y 60' against my stores of data to recover free space on my table of Compellent SAN.

    This article explains the command and the object: http://kb.vmware.com/selfservice/microsites/search.do?language=en_US & cmd = displayKC & externalId = 2014849

    From one or more hosts, I so need to go into each VMFS data store and run the command "vmkfstools y XX" to reclaim space. Otherwise the Compellent table see SVMotion jobs and snapshots as "new entries" and never release the free space.

    To automate this, I would use PowerCLI and maybe just run the script as a scheduled my vSphere Server task.

    I understand also the VMA device can do this kind of stuff, but I don't understand how to automate/schedule tasks with it more I prefer using PowerCLI.

    Anyway, sorry for the question noob and thanks in advance. Any help is very appreciated!

    The problem is we use thin Volumes put into service on a Board of 3par, with T10 off Unmap (which is now the default) freeing up space by deleting a virtual machine or by a storage vmotion means space gets released to the VMWare/data store layer and can be reused by Vpshere but he is not recovered at the Array level , delivering a vmkfstools, writes a file in the data store removes it returns T10Unmap to the matrix, the 3par then and returns this space to the free pool. It works when we manually we just want until VMWare decide UNMAP turn automate it.

    Brett

  • Automation of FDM integration Script in the Task Manager

    Hello world

    I have created an integration Script that copies the data of a table SQL to FDM and now tries to automate a daily run in the Task Manager.

    To do this, it seems that I have to create a custom Script to perform the following integration Script:
     Function LedgerTrans(strLoc, lngCatKey, dblPerKey, strWorkTableName) 
    I can't understand what it takes to write the custom Script to trigger the integration Script. Can someone explain or give a sample?



    Best regards
    Frederik

    You don't need a custom script, you can simply use batch processing to trigger the import for the POV. You must create a standard command using the GUI of batch script in the workbench (Tools > batch) then put the empty source files in the folder OpenBatch with the POV for the name of the file to trigger the import for the POV script.

  • Script to automate the affinity of the crib of DRS-groups

    Hello

    I am trying to automate the rules of affinity for the drs Group Manager. The idea is to let some virtual machines running on

    assigned to the esx host (type 'Run VMs on Hosts' / 'Should run on hosts in the group').

    Background: we have esx hosts in two data centers interconnected 10 giga with a metrocluster netapp on each site hosting the nfs exports. I created two groups of type "Host DRS Groups" (in datacenter esx host a go into one, hosts datacenter b go the other) and two groups of type 'Machine virtual DRS Groups' (virtual machines hosted on export nfs one go into one, while the virtual machines hosted on nfs export b go the other). In this way, we can prevent nfs/iscsi traffic across data centers.

    Create the rules manually in a small cluster works. However with dozens of virtual machines in the other groups, there must be a way to automate the task and that it is regualary. I let powercli generate a list of VMS according to nfs export (hard location is either the field a or site b) then import the given in the Virtual Machine DRS group concerned.

    Using get-drsrule-Cluster 'cluster ' | Export-CliXml does not display a details for groups of DRS HOST or Virtual Machine DRS. Is it possible to do it at all? I recon using set-drsrule let me import rules.

    Any help / ideas is appreceated.

    Concerning

    Sascha

    The current DrsRule cmdlets do not, all I know, allows you to work with groups of DRS.

    As an alternative, you can use the ReconfigureComputeResource method that is available.

    The script should look like this

    $clusterName = "MyCluster"
    $cluster = Get-Cluster -Name $clusterName
    
     $spec = New-Object VMware.Vim.ClusterConfigSpecEx
    $groupVM = New-Object VMware.Vim.ClusterGroupSpec $groupVM.operation = "add" $groupVM.Info = New-Object VMware.Vim.ClusterVmGroup $groupVM.Info.Name = "Grouped VM" 
    
    Get-VM -Name MyVM1* | %{
        $groupVM.Info.VM += $_.Extensiondata.MoRef
    }
    $spec.GroupSpec += $groupVM
    $groupESX = New-Object VMware.Vim.ClusterGroupSpec $groupESX.operation = "add"$groupESX.Info = New-Object VMware.Vim.ClusterHostGroup$groupESX.Info.Name = "Grouped Host"
    
    Get-VMHost -Name MyHost1* | %{
        $groupESX.Info.Host += $_.Extensiondata.MoRef
    }
    $spec.GroupSpec += $groupESX
    $rule = New-Object VMware.Vim.ClusterRuleSpec$rule.operation = "add"$rule.info = New-Object VMware.Vim.ClusterVmHostRuleInfo$rule.info.enabled = $true$rule.info.name = "Test DRS group rule"$rule.info.mandatory = $true$rule.info.vmGroupName = "Grouped VM"$rule.info.affineHostGroupName = "Group Host"$spec.RulesSpec += $rule
    $cluster.ExtensionData.ReconfigureComputeResource($spec,$true)
    
    The script first creates 2 DRS groups. One with the VMs and one with the ESX(i) servers.
    

    In the example, there all customers whose name starts with "MyVM1" for a group and all hosts whose name begins with "MyHost1" to the other group.

    These 2 selections will of course be changed for your configuration. Let me know what selection rules you want to implement for virtual machines and hosts and I can update the script.

    The script then creates a rule. Note that the rule specifies $true for the "required" property

    This means that a virtual machine will not be powered on if the placement host does not match the rule.

    The 2nd parameter to the ReconfigureComputeResource method allows you to specify if the changes defined in the $spec to add or not.

    If it's not $true all your cluster settings, except for the groups and the rule will be deleted. So, attention!

  • Scripts of Configuration tasks

    I need to perform the following tasks in the WebCenter 11 g (11.1.1.8.0) as actions scripted content:

    1. modify the Server Socket Port (according to me, there's a WLST command for this, setUCMServerPort?)

    2. Add an IP address for the filter security addresses for incoming connection Socket (another command WLST, setUCMIPAddressFilter?)

    3. set the Option of full text search.

    4 activate a component (Component Manager)

    5. Add a new role and change its permissions (User Admin Applet)

    6. create a new user and assign the new role (User Admin Applet)

    7. create fields of multiple Information (Applet Configuration Manager)

    8 start the reconstruction of Collection Cycle (Repository Manager Applet)

    9. create a new folder of Contribution

    So the question is, can these steps are completed using WLST, Web Services, a combination of both, or something else that we can program or script user interaction is not required to complete the configuration?

    sc0ttTehC0hdur wrote:

    I need to perform the following tasks in the WebCenter 11 g (11.1.1.8.0) as actions scripted content:

    1. modify the Server Socket Port (according to me, there's a WLST command for this, setUCMServerPort?)

    2. Add an IP address for the filter security addresses for incoming connection Socket (another command WLST, setUCMIPAddressFilter?)

    3. set the Option of full text search.

    4 activate a component (Component Manager)

    5. Add a new role and change its permissions (User Admin Applet)

    6. create a new user and assign the new role (User Admin Applet)

    7. create fields of multiple Information (Applet Configuration Manager)

    8 start the reconstruction of Collection Cycle (Repository Manager Applet)

    9. create a new folder of Contribution

    So the question is, can these steps are completed using WLST, Web Services, a combination of both, or something else that we can program or script user interaction is not required to complete the configuration?

    #1. Oracle WebCenter content personalized WLST orders - 11 g Release 1 (10.3.6)

    Yes, this can be set via WLST, but I don't know if the change will be written in the cfg file. You can use the manipulation of file to change this value.

    #2. See #1

    #3. Don't believe there's a WLST for this, but you can use the file manipulation technique that I mentioned.

    #4. Don't believe there is a service for this, but you can use the file manipulation technique that I mentioned.

    #5. You can take advantage of the web services or RIDC or idccommand to call add_role service

    #6. where would your username created? creating local users coe is not recommended. helps standard users in the4 embedded ldap is not friendly production. You can script a ldif file to push the new user, with groups in your LDAP

    #7. See #5, but it is the service ADD_METADEF; In addition, if it makes sense, you can have your components create their related metadata fields. I wrote a blog on that a few years ago.

    #8. See #5, but it is the START_SEARCH_INDEX service

    #9. See #5, but it is the COLLECTION_ADD service for contribution files (that is, not frameworkfolders)

    #10. you will need to restart your server after making these changes; You can use wlst for this.

    In short, Yes, it should be feasible.

    Hope this helps

    -ryan

    Sound clips SENA

  • Possibility to create a script that automatically opens files and processes?

    I have a folder on my computer which has automatically downloaded image files periodically. I would like to have a script in photoshop that can batch process them automatically and then move them out of the folder so that they are not treated again - but I just wanted to know if it was common or even possible. I do a lot of scripts, but I'm good enough to understand things if anyone has information or examples of scripts that can do something like that, that would be greatly appreciated. Thank you!

    Did you search Forum yet?

    Re: folder

  • Script to automate exporting to idml for many doctors (perhaps using Hotfolder)

    Hi all

    I'm looking for a solution automate the export many docs INDD to IDML. Has anyone made such a solution?

    Thanks in advance!

    Hello

    You will be certainly interested in exporting batch Script of Peter Kahrel.

    Not at the "Hotfolder" but for what I know.

    Free script Batch convert/export InDesign documents. Peter Kahrel

    Best,

    Loïc

    http://www.ozalto.com

  • Create a script of automatic action for the 3d rotation effect

    Is it possible to create a script action that automatically applyes rotation with specific settings 3d effect?

    An example would be when I press F2 it rotates the object instantly with my specific parameters without having to rely on anything else.

    Ok.

    you draw a shape, you want. Go to effect > 3D > Rotate and apply the desired settings.

    When your object is selected, go to the graphic Styles palette (window > graphic styles) and create the new graphic style (be it in the palette menu) or the small button. Call something memorable.

    Draw a new object, once again what you want. Open the actions palette (window > Actions). Create new action. Give it a name and assign it to a function key, and then click OK (the action will begin recording).

    Select your new object, then select your new graphic Style in the graphic styles palette. It should apply your 3D settings to the new object.

    Click on the button stop at the bottom of the Actions palette.

    create the new object, select it and press your chosen key. Enjoy.

  • Script for automatic placement of several text files?

    An editor I work with is slowed by a change to their workflow. Maybe there's a whole script for help? I looked but can not find, so I post here.

    Old workflow: Designers would be "automatic formatting" a single Word doc with all the preliminary pages (sometimes > 10 sections of diff.) and chapters and endnotes in a model book.

    New workflow: The Word doc is now divided into 30-40 InCopy files, always destined to a single InDesign layout doc (The InCopy files were created from a Word doc marked by a different system, so that they are all new to the InDesign user.)

    Y at - it a script which, according designers load a square slider with 30-40 (in the right order) files, which will allow them to simple-click on page 1, and InDesign will place one after the other files, autoflowing necessary? They still need them to be placed in individual InCopy files (so would not help concatenate Prime). I don't think that there is never a case of 2 stories being on the same page.

    Thank you

    AM

    Hey AnneMarie,

    This script allows you to select a bunch of files and will try to place them, one by one, in your InDesign document. It will be auto-flux them according to the needs (but be careful because standing in excess of problems - because the script does not test for this).

    I tested with a lot of property, but not with InCopy files because I did not. If they are adjustable as Word documents, the script must run end.

    Let us know if everything works correctly for you.

    // BS"D
    // Multi-file auto-place
    // An InDesign Script by Ariel, (c) Id-Extras.com, 2014
    // This script will allow the user to select a bunch of placeable files (Word docs, etc.)
    // It will then attempt to place and auto-flow all the selected files.
    // The script will start from page 1 of the active document
    // and keep adding pages as needed.
    // It will add text frames as needed, within the margins of the page.
    // IMPORTANT: There is no error-checking for perpetual overflow!!!
    // So, if something you're trying to place cannot fit within the margins,
    // The script will continue adding pages to InDesign until it crashes.
    // To quit the script, press ESC.
    var myDoc = app.activeDocument,
     myFiles = File.openDialog("Select files to place...", undefined, true),
     i,
     currentPage = myDoc.pages[0],
     prevFrame,
     myFrame;
    
    for (i = 0; i < myFiles.length; i++){
     myFrame = addFrame(currentPage);
     myFile = myFiles[i];
     try{
      myFrame.place(myFile, false);
     }
     catch(e){
      alert("Unable to place file: "+myFile, "Multi-file auto-place");
      continue;
     }
     while (myFrame.overflows){
      currentPage = addPageAfter(currentPage);
      prevFrame = myFrame;
      myFrame = addFrame(currentPage);
      prevFrame.nextTextFrame = myFrame;
     }
     currentPage = addPageAfter(currentPage);
    }
    function addFrame(aPage){
     var pageMargins = aPage.marginPreferences,
      aFrame = aPage.textFrames.add(),
      areFacing = app.activeDocument.documentPreferences.facingPages,
      myTop = aPage.bounds[0]+pageMargins.top,
      myBottom = aPage.bounds[2]-pageMargins.bottom,
      myLeft = aPage.bounds[1]+pageMargins.left,
      myRight = aPage.bounds[3]-pageMargins.right;
     //When document.documentPreferences.facingPages == true,
     //"left" means inside; "right" means outside.
     if (areFacing && aPage.side == PageSideOptions.LEFT_HAND){
       myLeft = aPage.bounds[1]+pageMargins.right;
       myRight = aPage.bounds[3]-pageMargins.left;
     }
     aFrame.geometricBounds = [myTop, myLeft, myBottom, myRight];
     return aFrame;
    }
    
    function addPageAfter(aPage){
     return myDoc.pages.add(LocationOptions.AFTER, aPage);
    }
    
  • Script to automatically replace the specific layers?

    Hello. I work for a small company and we frequently get client files I need to edit. Because of the way thay are formatted the layers always come with the same name/structure, but they still have a layer we need to replace. Go to a shared drive and manually place our desired element (a .pdf file if it is of importance) in the subset to continue with the file layer. Thus, for example, there will be a layer in the default file named layer 1, and this layer is Group 1 > Group > mask of clipping and Image.

    I know ideally we should simply fix the script that formats the layers, but for now is not possible. So what I would like to be able to do (assuming that it is still possible), is to have a script that we can run that automatically replaces the 'Image' file in these layers of subset, I spoke with a file to a location on a local computer (for example replace the 1 layer > Group 1 > Group > image.jpg with C:/example/example.pdf).

    I searched online and could not find anything, so I thought that I have turned to the community for help. Entries, suggestions or creative solutions would be greatly appreciated! And as always, thanks, everyone on these forums is usually very beautiful and impressive, so it's always nice to come here to help.

    Glad to see that you have accepted the challenge.

    Well, this should help you get started. Keep in mind, it is written in VB.NET then you will need to translate it is that you want in Javascript. At least you will have a model to begin with. This is just a quick hack for you to start with - you may need to change the layer you want the new image appears on, if it's important. In addition, it is assumed that you started with a plot point (image.jpg) and whether you want the new image to be incorporated. You will see the code tweak as you wish.

    Var app As Illustrator.Application = CreateObject ("Illustrator.Application")

    Dim aDoc as long as I. Document = app. ActiveDocument

    For each item in aDoc.RasterItems

    If the element. Name = "image.jpg" Then

    order of the day. Selected = True

    Dim newPlacedItem As AI. PlacedItem = aDoc.PlacedItems.Add

    newPlacedItem.File = "YourNewFilePathHere.pdf".

    newPlacedItem.Embed)

    order of the day. Delete()

    End If

    Next

    I hope this helps.

    -TT

  • Question in regards to the script for automatic filling check box

    Hello everyone.  First of all, let me say a big thank you to all the users, but also the admins of this forum.  As a user of LiveCycle newbie, I learned an incredible amount of research on the forum and reading of others.  Now, to my current question...

    I use a custom form created in LiveCycle ES 8.2 and wonder how to empower a checkbox to fill automatically (IE. 'on') based on a number entered in a numeric field by using a range of criteria.  To be more precise, I have (5) checkboxes that will be labeled as follows:

    Name: CheckBox1 < 500

    Name: CheckBox2 500-999

    Name: CheckBox3 1 000-1 499

    Name: CheckBox4 > 1 500

    Name: Checkbox5 no

    I don't want only a SINGLE checkbox auto fill based on a certain number I enter the numeric field (called "NumericField1").  For example, if I enter "889" number, I want only CheckBox2 AutoComplete in.  Not sure what script to use in the Script Editor for this.  Any help would be greatly appreciated.  Thank you very much in advance.

    MJ

    You are welcome. I added a second numeric field. NF1 is entered by the user option. NF2 is calculated field read-only to mimic your form. NF2 simply takes the value of nf1. I moved the logic of radio button in the radio button exclusion group calculate event to produce the results below. I think that's what you're after. The updated form is attached.

    Steve

Maybe you are looking for