LinuxQuestions.org
Visit Jeremy's Blog.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 01-09-2006, 08:10 AM   #1
javier_ccs
Member
 
Registered: Apr 2005
Location: Milton Keynes
Distribution: ubuntu 12.10
Posts: 90

Rep: Reputation: 15
question on expect language


hi guys,

i'm making a backup on the configuration of a juniper firewall and i'm using expect to create a script to handle it, but since i started to work with expect for the first time last saturday i hope i could get some help with it...


1. i would like to know how can i create a text file to save the output of a command?
ex: save the output of ping linux.org
Code:
>ping linux.org
From 192-168-127-red5.javier.com.ve (192.168.127.5): icmp_seq=1 Redirect Host(New nexthop: 192-168-127-red1.javier.com.ve (192.168.127.1))
64 bytes from linux.org (198.182.196.48): icmp_seq=1 ttl=49 time=124 ms
2. how can i make this script to run for example every 5th of the month? (ex: januaty 5, february 5, etc.)

i really would apreciate your help...
 
Old 01-09-2006, 10:44 AM   #2
rose_bud4201
Member
 
Registered: Aug 2002
Location: St Louis, MO
Distribution: Xubuntu, RHEL, Solaris 10
Posts: 929

Rep: Reputation: 30
1) To save the output of a command to a text file, pipe the command to a file, i.e.

ping linux.org > /path/to/filename.txt
ping linux.org 1> good_output.txt 2>errors_only.txt

where "1" will specify only program output sent to stdout, and 2 specifies only output sent to stderr. See here for more information.

2) look into 'cron' and the 'crontab' file. The man page can help you there, as can searching for crontab here on LQ.

HTH!
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Possibly the dumbest question I would ever expect to ask pyrael Linux - General 9 11-22-2005 05:52 AM
A question about expect. imjoe Programming 1 10-26-2005 04:42 AM
expect question deiussum Programming 0 08-05-2005 03:51 PM
expect question reitzell Programming 1 11-20-2004 09:03 AM
Double and single quote, Question in expect evilchild Programming 4 08-22-2004 05:34 PM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 11:08 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration