cancel
Showing results for 
Search instead for 
Did you mean: 

Can I save the results of a script to file?

Can I save the results of a script to file?

Martin_Shadbolt
New Contributor II
I need to login to a switch, run a 'show' command, then save the output to a file. I need to do this for 30+ switches, and would preferably like to save the output of each switch's show command to a filename matching it's hostname (SwitchA output to switcha.txt).
I know how to write a script to run the show command, but I don't know how to save it to a file.
Any ideas?
Thank you!
6 REPLIES 6

Sarah_Seidl
New Contributor III
You could save the configuration as a script (give it a name) then copy the files from your switch stack, say tftp off. It saves it as an .xsf file if that would work for you. Then you could copy the file off the switch stack to a centralized location. If you have netsight you can automate backups of your stacks.

Slot-1 SwitchA # save configuration as-script SwitchA
Do you want to save configuration to script SwitchA.xsf? (y/N) Yes
Saving configuration to script SwitchA.xsf on master .... done!
Synchronizing script to backup ... done!
Saving script on Standbys (Slots: 3,4).

Script saved on Standby (Slot-4): done!
Script saved on Standby (Slot-3): done!

davidj_cogliane
Contributor
If you run it as a task you can have it email you the results.
GTM-P2G8KFN