bash basics

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



I have the following two scripts (below) that I've gotten a bit confused
with.

What I want to do is dump a daily log of the router ip accounting into a
text file for that day.

The bash script 'runlog' runs the expect scripts 'commands'.

If I run '#expect commands' I get the output I want.
If I run 'runlog' the process runs through once and then stop
responding, and doesn't iterate.

I ended up writing the runlog script because a cron job for 'expect
commands >> logfile' did not run, but did create the file.

I'm a bit lost and a nudge in the right direction would be greatly
appreciated.


#!/bin/bash

today=/logs/$(date +%Y-%m-%d)$1.log

#echo Starting Router log...
expect -f /root/commands >> $today

echo Completed router log for $today. Sleeping for 10 minutes.
sleep 10m
exec /root/runlog


#!/usr/bin/expect -f
spawn telnet xxx.xxx.xxx.xxx

send "xxxxxx\r"
send "en\r"
send "xxxxxx\r"
wait -nowait

send "term len 0\r"
send "sh ip accou\r"
wait -nowait

send "clear ip acco\r"
wait -nowait

send "exit\r"
interact




-- 
Psyche-list mailing list
Psyche-list@redhat.com
https://listman.redhat.com/mailman/listinfo/psyche-list

[Index of Archives]     [Fedora General Discussion]     [Red Hat General Discussion]     [Centos]     [Kernel]     [Red Hat Install]     [Red Hat Watch]     [Red Hat Development]     [Red Hat 9]     [Gimp]     [Yosemite News]

  Powered by Linux