Linux: Schedule command to run once after reboot (RunOnce equivalent)

Posted by Christopher Parker on Server Fault See other posts from Server Fault or by Christopher Parker
Published on 2010-06-04T19:46:53Z Indexed on 2010/06/05 6:03 UTC
Read the original article Hit count: 417

Filed under:
|
|

I'd like to schedule a command to run after reboot on a Linux box. I know how to do this so the command consistently runs after every reboot with a @reboot crontab entry, however I only want the command to run once. After it runs, it should be removed from the queue of commands to run. I'm essentially looking for a Linux equivalent to RunOnce in the Windows world.

In case it matters:

$ uname -a
Linux devbox 2.6.27.19-5-default #1 SMP 2009-02-28 04:40:21 +0100 x86_64 x86_64 x86_64 GNU/Linux
$ bash --version
GNU bash, version 3.2.48(1)-release (x86_64-suse-linux-gnu)
Copyright (C) 2007 Free Software Foundation, Inc.
$ cat /etc/SuSE-release
SUSE Linux Enterprise Server 11 (x86_64)
VERSION = 11
PATCHLEVEL = 0

Is there an easy, scriptable way to do this?

© Server Fault or respective owner

Related posts about linux

Related posts about scheduled-task