What is the best way to schedule a task that is be executed years later? Like execute a script after 4 years.
Is cron the best method for that?
Server Fault is a question and answer site for system and network administrators. It only takes a minute to sign up.Sign up to join this community
Any computer system which will be running sufficiently unmodified, after four years, that a script remains valid without modificaiton is somewhat static. Any scheduling system which assumes that one box will still be serving the same role so much later is rather optimistic. Hard disk failure or other problems would make it likely that you get to discover whether or not your backups handle storing the "transient" at-jobs.
It would likely be more robust to look instead at "how do I test if maintenance task X has been run such that the lifetime of the data has been extended out past another N months from now"; eg, domains all renewed, SSL certificates not expiring, etc. Then you can run the job daily, weekly, monthly, or some other frequency higher than "yearly". This means that the code gets exercised and you'll be sure it will run. Especially if the tool registers its success somewhere.
If all else fails, a departmental shared calendar with a bunch of reminders, which send email, may be useful. You can be moderately sure that if the calendar is replaced, or migrated to The Cloud, or whatever else, that someone will take the effort to migrate all the events so that the VIPs don't need to re-enter anything. So your reminder will be migrated "for free" without anyone having to remember this task that only happens every four years.