PDA

View Full Version : [all variants] One-time cron job



lucacerone
February 15th, 2011, 10:44 AM
Dear all,
I've a question.
Due to the maintenance policy of my university,
my computer (ubuntu 10.04 on it) will need to be rebooted tomorrow to
gain the new ip-address.

It is just a curiosity, I'd like to know if it's possible
to set a one-time cron job.

I'd like that tomorrow at 9 my computer would reboot and after that
the job is no longer executed.

Is this possible?
Thanks a lot for your help.
Cheers, -Luca

anglican
February 15th, 2011, 11:33 AM
Dear all,
I've a question.
Due to the maintenance policy of my university,
my computer (ubuntu 10.04 on it) will need to be rebooted tomorrow to
gain the new ip-address.

It is just a curiosity, I'd like to know if it's possible
to set a one-time cron job.

I'd like that tomorrow at 9 my computer would reboot and after that
the job is no longer executed.

Is this possible?
Thanks a lot for your help.
Cheers, -LucaFor a one-off "at" is what you need, not cron.

H

lucacerone
February 15th, 2011, 11:46 AM
thanks!

lucacerone
February 15th, 2011, 12:02 PM
Sorry just the last help:
I've tried to run a test using


at -m 11:01 AM FEB 15 2011 < 'echo "test" > home/luca/Desktop/atlog'

But this way it doesn't work.
How can I create a file at a given time?
Thanks a lot for your help,
Cheers, -luca

anglican
February 15th, 2011, 12:14 PM
Sorry just the last help:
I've tried to run a test using

But this way it doesn't work.
How can I create a file at a given time?
Thanks a lot for your help,
Cheers, -lucaI've only used at to run scripts e.g.

at -f /path/to/script -v 11:15so I'm no expert in using it. BTW you can always run shutdown with a time e.g.
shutdown +1440 -r to reboot in 24 hours time.

H

Rhubarb
February 15th, 2011, 12:34 PM
How can I create a file at a given time?
Thanks a lot for your help,
Cheers, -luca

Try this one out:

echo "echo 'test' > ~/testing.txt" | at 22:31

This will also work:

echo "echo \"test\" > ~/testing.txt" | at 22:33

And I'm sure there's plenty of other ways of getting it to work too.