Sample .profile and .cloginrc
linuxhost@client1:~$ cat .cloginrc
add password 10.0.0.22 {cisco} {cisco}
add method * telnet ssh
add password 10.0.0.22 {cisco} {cisco}
add method * telnet ssh
linuxhost@client1:~$cat .profile
export PATH=$PATH:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/lib/rancid/bin/:/home/netadmin
linuxhost@client1:~$ clogin 10.0.0.22
10.0.0.22
spawn telnet 10.0.0.22
spawn telnet 10.0.0.22
Trying 10.0.0.22...
Connected to 10.0.0.22.
Escape character is '^]'.
User Access Verification
Password:
R1>enable
Password:
R1#
R1#
Connected to 10.0.0.22.
Escape character is '^]'.
User Access Verification
Password:
R1>enable
Password:
R1#
R1#
Here is a sample config of the backup script.
#!/bin/bash
# Variables
clogin=/usr/lib/rancid/bin/clogin
path=/backup/
tdy=`date +%m%d%Y`
#network equipment backup
$clogin -c 'write term' 10.0.0.22 > $path/r1-$tdy.cfg
# Variables
clogin=/usr/lib/rancid/bin/clogin
path=/backup/
tdy=`date +%m%d%Y`
#network equipment backup
$clogin -c 'write term' 10.0.0.22 > $path/r1-$tdy.cfg
Here is the crontab output
42 8 * * * /home/netadmin/backup.sh >/dev/null 2>&1