Discussion:
[rancid] "copy run start" from a script
Gregory Bruccoleri
2014-01-10 16:26:49 UTC
Permalink
Hello all, I have the following script but want to ensure that when changes
are completed that the configuration changes are written to the startup
config.

Here is my script:

#!/bin/bash
for line in $(cat routers.txt)
do
su -s /bin/bash -l rancid -c "/home/rancid/bin/clogin -x commands.cmds
$line"
done

I've tried using the flat text command within "commands.cmds" to no avail
and the -S option without success.

Does anyone have any input on how to make this work?

Thanks in advance,
G
Daniel Schmidt
2014-01-10 19:27:17 UTC
Permalink
Y reinvent wheel?

http://sourceforge.net/projects/cosi-nms/files/ciscocmd/
Post by Gregory Bruccoleri
Hello all, I have the following script but want to ensure that when
changes are completed that the configuration changes are written to the
startup config.
#!/bin/bash
for line in $(cat routers.txt)
do
su -s /bin/bash -l rancid -c "/home/rancid/bin/clogin -x commands.cmds
$line"
done
I've tried using the flat text command within "commands.cmds" to no avail
and the -S option without success.
Does anyone have any input on how to make this work?
Thanks in advance,
G
_______________________________________________
Rancid-discuss mailing list
http://www.shrubbery.net/mailman/listinfo/rancid-discuss
E-Mail to and from me, in connection with the transaction
of public business, is subject to the Wyoming Public Records
Act and may be disclosed to third parties.
Gregory Bruccoleri
2014-01-10 21:08:56 UTC
Permalink
Hi Daniel,

Thanks for the link but I'm looking for something to run exclusively within
rancid and bash. The script I have works except sending the carriage
return when writing the config to startup. I figure an option on the last
line would do it but no dice.

#!/bin/bash
for line in $(cat routers.txt)
do
su -s /bin/bash -l rancid -c "/home/rancid/bin/clogin -c 'copy run start'
$line"
done

I'm getting closer it seems as when this is ran it will display the command
but after entering the command it times out:

router#copy run start

Error: TIMEOUT reached
Post by Daniel Schmidt
Y reinvent wheel?
http://sourceforge.net/projects/cosi-nms/files/ciscocmd/
Post by Gregory Bruccoleri
Hello all, I have the following script but want to ensure that when
changes are completed that the configuration changes are written to the
startup config.
#!/bin/bash
for line in $(cat routers.txt)
do
su -s /bin/bash -l rancid -c "/home/rancid/bin/clogin -x commands.cmds
$line"
done
I've tried using the flat text command within "commands.cmds" to no avail
and the -S option without success.
Does anyone have any input on how to make this work?
Thanks in advance,
G
_______________________________________________
Rancid-discuss mailing list
http://www.shrubbery.net/mailman/listinfo/rancid-discuss
E-Mail to and from me, in connection with the transaction
of public business, is subject to the Wyoming Public Records
Act and may be disclosed to third parties.
heasley
2014-01-10 22:50:04 UTC
Permalink
Post by Gregory Bruccoleri
Hi Daniel,
Thanks for the link but I'm looking for something to run exclusively within
rancid and bash. The script I have works except sending the carriage
return when writing the config to startup. I figure an option on the last
line would do it but no dice.
#!/bin/bash
for line in $(cat routers.txt)
do
su -s /bin/bash -l rancid -c "/home/rancid/bin/clogin -c 'copy run start'
$line"
done
I'm getting closer it seems as when this is ran it will display the command
router#copy run start
clogin -c 'write mem' device
Post by Gregory Bruccoleri
Error: TIMEOUT reached
Post by Daniel Schmidt
Y reinvent wheel?
http://sourceforge.net/projects/cosi-nms/files/ciscocmd/
Post by Gregory Bruccoleri
Hello all, I have the following script but want to ensure that when
changes are completed that the configuration changes are written to the
startup config.
#!/bin/bash
for line in $(cat routers.txt)
do
su -s /bin/bash -l rancid -c "/home/rancid/bin/clogin -x commands.cmds
$line"
done
I've tried using the flat text command within "commands.cmds" to no avail
and the -S option without success.
Does anyone have any input on how to make this work?
Thanks in advance,
G
_______________________________________________
Rancid-discuss mailing list
http://www.shrubbery.net/mailman/listinfo/rancid-discuss
E-Mail to and from me, in connection with the transaction
of public business, is subject to the Wyoming Public Records
Act and may be disclosed to third parties.
_______________________________________________
Rancid-discuss mailing list
http://www.shrubbery.net/mailman/listinfo/rancid-discuss
Howard Jones
2014-01-10 23:29:40 UTC
Permalink
http://networkengineering.stackexchange.com/questions/3791/suppress-confirmation-prompts-in-ios-when-copying-files

Either "write memory" for older devices, or apparently you can disable
that prompt. It's a global config option though, not a command-line
thing on the copy command.
Post by Gregory Bruccoleri
Hi Daniel,
Thanks for the link but I'm looking for something to run exclusively
within rancid and bash. The script I have works except sending the
carriage return when writing the config to startup. I figure an
option on the last line would do it but no dice.
#!/bin/bash
for line in $(cat routers.txt)
do
su -s /bin/bash -l rancid -c "/home/rancid/bin/clogin -c 'copy run
start' $line"
done
I'm getting closer it seems as when this is ran it will display the
router#copy run start
Error: TIMEOUT reached
On Fri, Jan 10, 2014 at 2:27 PM, Daniel Schmidt
Y reinvent wheel?
http://sourceforge.net/projects/cosi-nms/files/ciscocmd/
On Fri, Jan 10, 2014 at 9:26 AM, Gregory Bruccoleri
Hello all, I have the following script but want to ensure that
when changes are completed that the configuration changes are
written to the startup config.
#!/bin/bash
for line in $(cat routers.txt)
do
su -s /bin/bash -l rancid -c "/home/rancid/bin/clogin -x
commands.cmds $line"
done
I've tried using the flat text command within "commands.cmds"
to no avail and the -S option without success.
Does anyone have any input on how to make this work?
Thanks in advance,
G
_______________________________________________
Rancid-discuss mailing list
http://www.shrubbery.net/mailman/listinfo/rancid-discuss
E-Mail to and from me, in connection with the transaction
of public business, is subject to the Wyoming Public Records
Act and may be disclosed to third parties.
_______________________________________________
Rancid-discuss mailing list
http://www.shrubbery.net/mailman/listinfo/rancid-discuss
Gaurav Sabharwal
2014-01-10 21:41:13 UTC
Permalink
Greg,

I don't see how that will work as the command is interactive. You might
want to use 'wr mem' or depending upon what you trying to do you can use an
EEM that gets triggered on a logout and does a wr mem.

Ping me at work! Unity! :)

Gaurav
Post by Gregory Bruccoleri
Hi Daniel,
Thanks for the link but I'm looking for something to run exclusively
within rancid and bash. The script I have works except sending the
carriage return when writing the config to startup. I figure an option on
the last line would do it but no dice.
#!/bin/bash
for line in $(cat routers.txt)
do
su -s /bin/bash -l rancid -c "/home/rancid/bin/clogin -c 'copy run start'
$line"
done
I'm getting closer it seems as when this is ran it will display the
router#copy run start
Error: TIMEOUT reached
Post by Daniel Schmidt
Y reinvent wheel?
http://sourceforge.net/projects/cosi-nms/files/ciscocmd/
Post by Gregory Bruccoleri
Hello all, I have the following script but want to ensure that when
changes are completed that the configuration changes are written to the
startup config.
#!/bin/bash
for line in $(cat routers.txt)
do
su -s /bin/bash -l rancid -c "/home/rancid/bin/clogin -x commands.cmds
$line"
done
I've tried using the flat text command within "commands.cmds" to no
avail and the -S option without success.
Does anyone have any input on how to make this work?
Thanks in advance,
G
_______________________________________________
Rancid-discuss mailing list
http://www.shrubbery.net/mailman/listinfo/rancid-discuss
E-Mail to and from me, in connection with the transaction
of public business, is subject to the Wyoming Public Records
Act and may be disclosed to third parties.
_______________________________________________
Rancid-discuss mailing list
http://www.shrubbery.net/mailman/listinfo/rancid-discuss
Gregory Bruccoleri
2014-01-10 19:48:51 UTC
Permalink
Hi Daniel,

Thanks for the link but I'm looking for something to run exclusively within
rancid and bash. The script I have works except sending the carriage
return when writing the config to startup. I figure an option on the last
line would do it but no dice.

Thanks,
G
Post by Daniel Schmidt
Y reinvent wheel?
http://sourceforge.net/projects/cosi-nms/files/ciscocmd/
Post by Gregory Bruccoleri
Hello all, I have the following script but want to ensure that when
changes are completed that the configuration changes are written to the
startup config.
#!/bin/bash
for line in $(cat routers.txt)
do
su -s /bin/bash -l rancid -c "/home/rancid/bin/clogin -x commands.cmds
$line"
done
I've tried using the flat text command within "commands.cmds" to no avail
and the -S option without success.
Does anyone have any input on how to make this work?
Thanks in advance,
G
_______________________________________________
Rancid-discuss mailing list
http://www.shrubbery.net/mailman/listinfo/rancid-discuss
E-Mail to and from me, in connection with the transaction
of public business, is subject to the Wyoming Public Records
Act and may be disclosed to third parties.
Loading...