How to schedule command execution 1 month from now?

P

postcd

Guest
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?
 


P

postcd

Guest
thx, alas I did not found answer on yours linked page and also i found "at" but i dont understand its manual and usage for my really simple question - puprose.
 
Z

ZZs

Guest
at 8pm +30 days
at>rm -rf /root/scriptname.sh
at> "ctrl+d" to close

or
at 8pm jun 05
at>rm -rf /root/scriptname.sh
at> "ctrl+d" to close

I use a one liner to call a simple script that contains the commands I want executed:
at -f /home/zz/bin/chkup2 17:15 may 9

atq will show you the jobs scheduled.

at my need to be installed and atd must be running (run atd as service so its up and ready.)

Do a test then read the man page again to learn more options.

If the schedule needs to be repeated often read up on cron.
 
P

Pantek Support

Guest
We also recommend using cron for items schedule so far in advance. You can typically place a new file in /etc/cron.d directory (called for example "deleteinthirty") containing something like the following, which would schedule it literally 30 days from today (on 8/8/2014) and automatically remove itself when done.

01 01 08 08 * rm -rf /root/scriptname.sh ; rm -f /etc/cron.d/deleteinthirty
 

Members online

No members online now.

Latest posts

Top