Perl cisco copy running to startup


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Perl cisco copy running to startup
# 1  
Old 03-28-2013
Perl cisco copy running to startup

Hi all,

i have a small simple perl that i cant make it work it is really stupid but i cant find solution and i needed fast.
im trying to copy running to startup on a cisco router and show me the output like is ok

Destination filename [startup-config]?
Building configuration...
[OK]

so the code i have is

Code:
use Net::Telnet::Cisco;

$device = "172.16.83.251";

  my $session = Net::Telnet::Cisco->new(Host => "$device",
									Input_log => "perllogrouter/router83.log",
										);
  $session->login('admin', 'admin');

  # Execute a command
  @output = $session->cmd ('copy running-config startup-config');
    print @output;
  @output = $session->cmd ('show startup-config');
  print @output;
  $session->close;

and the problem i have is that when it uses the command "copy running-config startup-config" it have to use another input "Enter" to continue and that is my problem here ... it can't continue because i have to use this command "Destination filename [startup-config]? "
sorry for bad English

---------- Post updated at 06:11 AM ---------- Previous update was at 05:25 AM ----------

Well i have found the solution ....


Code:
@output = $session->cmd("copy running-config "
                    . "startup-config\n");
 
  
  print @output;

tnx any way Smilie
Login or Register to Ask a Question

Previous Thread | Next Thread

9 More Discussions You Might Find Interesting

1. UNIX for Advanced & Expert Users

Script not running at startup

I am having check.sh script and check.service which I include to /etc/systemd/system/ chmod 744 /usr/local/bin/check.sh chmod 664 /etc/systemd/system/check.service systemctl daemon-reload systemctl enable check.servicecheck.sh: websockify 5555 localhost:7000 & date >... (9 Replies)
Discussion started by: tomislav91
9 Replies

2. Shell Programming and Scripting

Perl Telnet cisco routers

Hi all i have little problem finding solution about simple telnet script .... i have 250 routers and on some i have different password and on some they ask just for password no username. So for example 1,2,3 have username and password (user,password) 4, and 5 have different username and password... (0 Replies)
Discussion started by: IvanMP
0 Replies

3. IP Networking

How to show Cisco Router Running Configuration in Third Party Application

Hey everyone, I have a few question. 1. Is it possible to display cisco 'show run' output command to the application ?? 2. And is there any ways to log in to the router instead of using telnet from telnet application??? Thanks in advance (0 Replies)
Discussion started by: franzramadhan
0 Replies

4. Red Hat

running my own script during startup

Hi, I am using scientific linux with is a red hat cloning. I have written a script and I want it to be run during startup before the user log in. How do I do that? I know that there is some connection to the run level and the directory /etc/rc.d. But I don't know how exactly to do it ?... (4 Replies)
Discussion started by: programAngel
4 Replies

5. AIX

running fsck on aix in startup

Hi, I would like to know in which file I can get the option of enabling/disabling of running fsck on particular file system. As I know in /etc/filesystems these parameter should be there just like in Linux /etc/fstab I have created file system aix test but unable to find the option of... (1 Reply)
Discussion started by: manoj.solaris
1 Replies

6. Shell Programming and Scripting

perl telnet issue with cisco

Hi Experts, I am using perl to telnet on cisco boxes. We have this stupid cisco node which does not support "terminal Length0" command. Since I am using Net::Telnet and capturing output with @output = $telnet->cmd('cmd'); Say @output = $telnet->cmd('show version'); Now problem... (2 Replies)
Discussion started by: mtomar
2 Replies

7. Solaris

stop solaris 8 sendmail from running on startup

sorry i got this already... (3 Replies)
Discussion started by: itik
3 Replies

8. Shell Programming and Scripting

Perl telnet to cisco router and compare the ping ms

All Please help, i will telnet to router to obain the ping status and compare, if higher than normal latency, i will have further action.. if i do the telent and in perl script then .... e.g the result i obtain from the router will be =' Success rate is 100 percent (5/5), round-trip... (4 Replies)
Discussion started by: optimus
4 Replies

9. Shell Programming and Scripting

Running a Cron Script only @ Startup Pls Help!!

Hi friends i have a script "backup.sh" which is stored in "/var/lib/pgsql" directory. I want it to run as a cron so that it executes every time the system starts. I tried the follwing method I logged in as the root user and typed "crontab -e" The file was completly blank so i put the... (3 Replies)
Discussion started by: perk_bud
3 Replies
Login or Register to Ask a Question