Find the answer to your Linux question:
Results 1 to 5 of 5
I am looking to create a shell script that utilises the traceroute command i need it to output the data to a text file, so that i can use it ...
  1. #1
    Linux Newbie usblackhawk's Avatar
    Join Date
    Apr 2005
    Location
    London, UK
    Posts
    241

    Creating a shell script

    I am looking to create a shell script that utilises the traceroute command

    i need it to output the data to a text file, so that i can use it to take statistics from.
    i also need the file to run 3 times a day for about 7 days.

    Can anyone advise me on how to go about this? or how to code it?

    thanks.

  2. #2
    Linux Enthusiast
    Join Date
    Aug 2006
    Posts
    631
    You can redirect your output within your script to your logfile:

    Code:
    echo "Message ..." >> /directory/logfile
    or redirect the output in your crontab file like:

    Code:
    30 4 * * * /mydir/my_script.sh >> /directory/logfile
    This is an example of a cron job that runs once a day at 4:30a.

    You can find a bunch of examples on the net to set up a cron job if you Google on "crontab tutorial".

    Regards

  3. #3
    Linux Newbie usblackhawk's Avatar
    Join Date
    Apr 2005
    Location
    London, UK
    Posts
    241
    so then i would put that cron code in a shell script?

    how would i make a shell script, and how would the compute know to run this script if the cron code was put inside it?

  4. #4
    Linux Newbie usblackhawk's Avatar
    Join Date
    Apr 2005
    Location
    London, UK
    Posts
    241
    i have tried

    Code:
    07 22 * * 1-7 echo "Message/.........." >> /home/directory/test
    but i get an error saying bash: 07: command not found

  5. #5
    Linux Newbie usblackhawk's Avatar
    Join Date
    Apr 2005
    Location
    London, UK
    Posts
    241
    no matter.. figured it out.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
...