LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Server
User Name
Password
Linux - Server This forum is for the discussion of Linux Software used in a server related context.

Notices


Reply
  Search this Thread
Old 02-17-2011, 11:22 AM   #1
tdnnash25
Member
 
Registered: Apr 2009
Posts: 63

Rep: Reputation: 15
How can I move a file when it's mtime is now?


Hi,

I have some .call files which all have a future mtime. I want to move these files to /var/spool/asterisk/outgoing when the current server time and the mtime match ... or when the mtime is a second older than the current server time.


Example call file:
-rw-r----- 1 asterisk asterisk 241 2011-02-17 10:43:52 test.call

So, when the server's date/time is 2011-02-17 10:43:52, I want to move this call file to /var/spool/asterisk/outgoing so that Asterisk can place the call. I know I can just move these files to the Asterisk outgoing directory to begin with and the calls won't go out (b/c Asterisk will only trigger the call when the mtime is older or equal to the server time) ... but I'd rather not put them in that directory to begin with. When you restart Asterisk with certain parameters, it deletes .call files in its outgoing dir ...

help?
 
Old 02-17-2011, 01:04 PM   #2
Guttorm
Senior Member
 
Registered: Dec 2003
Location: Trondheim, Norway
Distribution: Debian and Ubuntu
Posts: 1,464

Rep: Reputation: 450Reputation: 450Reputation: 450Reputation: 450Reputation: 450
You could use "at" but it doesn't support seconds. I don't know if that's important. You also need to specify the time before the date.

Code:
echo "mv /full/path/to/test.call /var/spool/asterisk/outgoing/" | at "10:43 2011-02-17"
 
Old 02-17-2011, 01:14 PM   #3
Reuti
Senior Member
 
Registered: Dec 2004
Location: Marburg, Germany
Distribution: openSUSE 15.2
Posts: 1,339

Rep: Reputation: 260Reputation: 260Reputation: 260
Instead of moving the file to the outgoing directory, what about putting a hardlink to the file with the same mtime there? Even if Asterisk will remove it due to a restart, the original file will still be there. Well, you have to recreate the hardlink in this case.
 
Old 02-17-2011, 02:15 PM   #4
tdnnash25
Member
 
Registered: Apr 2009
Posts: 63

Original Poster
Rep: Reputation: 15
Quote:
Originally Posted by Guttorm View Post
You could use "at" but it doesn't support seconds. I don't know if that's important. You also need to specify the time before the date.

Code:
echo "mv /full/path/to/test.call /var/spool/asterisk/outgoing/" | at "10:43 2011-02-17"
Seconds aren't that important to me I don't think. I will play with that. I will play with the at command. I didn't even know such a command existed. I love linux.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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
Using find with file name and mtime to remove files gets Arg list too long error smaxey Linux - General 3 12-30-2009 06:34 PM
Allow users other than the owner to change the mtime of a file groszdani Linux - General 1 09-08-2009 07:00 PM
using find to compare file mtime with another file's mtime TheFueley Linux - Newbie 1 12-23-2008 09:06 PM
Can you move a file or directory and still retain mtime? ddenton Linux - General 3 11-21-2008 05:54 PM
why does sftp change mtime file attribute? hazelhill Linux - Software 3 10-17-2004 10:42 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Server

All times are GMT -5. The time now is 12:43 AM.

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