LinuxQuestions.org
Visit Jeremy's Blog.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - General
User Name
Password
Linux - General This Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.

Notices


Reply
  Search this Thread
Old 05-04-2014, 04:42 PM   #1
postcd
Member
 
Registered: Oct 2013
Posts: 527

Rep: Reputation: Disabled
How to schedule command execution 1 month from now?


Hello,

whats the fastest way to execute certain command with like X days or month delay?

i mean like:

delay -d 30 rm -rf /root/scriptname.sh

is there anything like that?
 
Old 05-04-2014, 05:17 PM   #2
unSpawn
Moderator
 
Registered: May 2001
Posts: 29,415
Blog Entries: 55

Rep: Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600
See 'man at'.
 
Old 05-05-2014, 02:50 PM   #3
postcd
Member
 
Registered: Oct 2013
Posts: 527

Original Poster
Rep: Reputation: Disabled
Already did and i dont know how to make it execute after month or lest say 45 days.
 
Old 05-05-2014, 03:37 PM   #4
suicidaleggroll
LQ Guru
 
Registered: Nov 2010
Location: Colorado
Distribution: OpenSUSE, CentOS
Posts: 5,573

Rep: Reputation: 2142Reputation: 2142Reputation: 2142Reputation: 2142Reputation: 2142Reputation: 2142Reputation: 2142Reputation: 2142Reputation: 2142Reputation: 2142Reputation: 2142
Did you read it?

It says pretty clearly, in the first paragraph
Quote:
You can also give times like now + count time-units, where the time-units can be minutes, hours, days, or weeks
So it sounds to me like you could use
Code:
at now + 30 days
For more on at's usage, see:
http://www.brunolinux.com/02-The_Ter...t_Command.html
 
Old 05-06-2014, 12:47 PM   #5
postcd
Member
 
Registered: Oct 2013
Posts: 527

Original Poster
Rep: Reputation: Disabled
Do NOT works!

Code:
at now + 30 days
syntax error. Last token seen: e
Garbled time
 
Old 05-06-2014, 12:52 PM   #6
suicidaleggroll
LQ Guru
 
Registered: Nov 2010
Location: Colorado
Distribution: OpenSUSE, CentOS
Posts: 5,573

Rep: Reputation: 2142Reputation: 2142Reputation: 2142Reputation: 2142Reputation: 2142Reputation: 2142Reputation: 2142Reputation: 2142Reputation: 2142Reputation: 2142Reputation: 2142
Quote:
Last token seen: e
There is no 'e' in what you put in the code tags, which means that's not the command you ran.

Code:
$ ls atfile
ls: cannot access atfile: No such file or directory
$ at now + 1 minute
at> touch ~/atfile
at> <EOT>
job 40 at Tue May  6 11:52:00 2014
$ sleep 60
$ ls atfile
atfile
Works fine for me...
 
Old 05-06-2014, 03:28 PM   #7
unSpawn
Moderator
 
Registered: May 2001
Posts: 29,415
Blog Entries: 55

Rep: Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600
...or the way shorter
Code:
echo "/bin/rm -f /root/scriptname.sh" | /usr/bin/at now + 45 days
 
  


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 On
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
LXer: Fedora 18 Is Now One Month Behind Schedule LXer Syndicated Linux News 0 10-16-2012 03:30 PM
[SOLVED] Remote command execution via SSH and newgrp command SuperMegaMau Linux - General 4 05-13-2011 07:31 AM
Schedule a command with 'at' genogebot Linux - Newbie 13 07-12-2010 02:56 AM
Usage of AT Command to Schedule a Program gartura Linux - General 5 05-13-2010 04:32 PM
Only execute 2nd command on successufl execution of 1st command kregec05 Linux - Newbie 3 08-19-2009 10:29 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - General

All times are GMT -5. The time now is 10:18 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