The UNIX and Linux Forums  
Hello and Welcome from United States to the UNIX and Linux Forums! Thank You for Visiting and Joining Our Global Community.

Go Back   The UNIX and Linux Forums > Top Forums > Shell Programming and Scripting
.
google unix.com



Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts and shell scripting languages here.

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
repeat character with printf ripat Shell Programming and Scripting 13 06-18-2009 06:01 AM
FTP repeat sending files Euler04 Shell Programming and Scripting 1 11-24-2005 02:46 PM
Repeat Commands dereckbc UNIX for Dummies Questions & Answers 6 01-04-2005 11:15 AM
any idea to repeat a action in VI myelvis UNIX for Dummies Questions & Answers 6 11-26-2003 06:21 AM
Repeat a command in a shell scotty UNIX for Dummies Questions & Answers 2 10-30-2002 02:42 AM

Closed Thread
English Japanese Spanish French German Portuguese Italian Dutch Swedish Russian Norwegian Hungarian Hebrew Danish Powered by Powered by Google
 
LinkBack Thread Tools Search this Thread Rate Thread Display Modes
  #1 (permalink)  
Old 09-06-2007
falcondown01 falcondown01 is offline
Registered User
  
 

Join Date: Sep 2007
Location: them crazy hills in Missouri
Posts: 5
to copy and repeat

Hi All,
I have done some looking at other threads but haven't found quite what I am looking for. I am a newbie to scripting and haven't got to where I want to you but here is my basic question. I have a script to copy a file and send it to another file with a date and time stamp. What I want to do is to be able to repeat this command within the script to happen every 30 (or 45 or 60) minutes. I have looked at doing a cron job but want more maual intervention to start and stop the script. So I am looking to just have the commands in the script repeat itself after a sleep. Here is the script I have so far:

#! /bin/sh
for i in `ls sband_log_error`
do
mv $i labfiles/int/sband/$i$(date +%F-%T)
done

Thanks,
falcondown01
  #2 (permalink)  
Old 09-06-2007
younggun younggun is offline
Registered User
  
 

Join Date: Aug 2007
Posts: 13
use 'sleep n'
--------------------------
Usage: sleep NUMBER[SUFFIX]...
or: sleep OPTION
Pause for NUMBER seconds. SUFFIX may be `s' for seconds (the default),
`m' for minutes, `h' for hours or `d' for days. Unlike most implementations
that require NUMBER be an integer, here NUMBER may be an arbitrary floating
point number.
  #3 (permalink)  
Old 09-07-2007
falcondown01 falcondown01 is offline
Registered User
  
 

Join Date: Sep 2007
Location: them crazy hills in Missouri
Posts: 5
Thanks younggun, should it be inserted at the end of the mv command?

Thanks for the info,
falcondown01
  #4 (permalink)  
Old 09-07-2007
younggun younggun is offline
Registered User
  
 

Join Date: Aug 2007
Posts: 13
whether inserted at the end of the mv command is determind by the 'sleep code' infront of the mv command or behind.
  #5 (permalink)  
Old 09-07-2007
falcondown01 falcondown01 is offline
Registered User
  
 

Join Date: Sep 2007
Location: them crazy hills in Missouri
Posts: 5
Hi younggun,
Thanks for the info. I was able to finish this script today. Below is the final script and it worked for copying this file i need over and over.

#! /bin/csh
while 1
cp -p file_name /directory/to/copy/to/file_name'date '+%d%h%y_%T''
sleep 1800
end

Again Thanks for the help!
Falcondown01
Closed Thread

Bookmarks

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes Rate This Thread
Rate This Thread:

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 On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On




All times are GMT -4. The time now is 04:50 PM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited. Language Translations Powered by .
vBCredits v1.4 Copyright ©2007 - 2008, PixelFX Studios
The UNIX and Linux Forums Content Copyright ©1993-2009. All Rights Reserved.Ad Management by RedTyger

Content Relevant URLs by vBSEO 3.2.0