Files
hpr-knowledge-base/hpr_transcripts/hpr3398.txt
Lee Hanken 7c8efd2228 Initial commit: HPR Knowledge Base MCP Server
- MCP server with stdio transport for local use
- Search episodes, transcripts, hosts, and series
- 4,511 episodes with metadata and transcripts
- Data loader with in-memory JSON storage

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-10-26 10:54:13 +00:00

133 lines
12 KiB
Plaintext

Episode: 3398
Title: HPR3398: Anacron
Source: https://hub.hackerpublicradio.org/ccdn.php?filename=/eps/hpr3398/hpr3398.mp3
Transcribed: 2025-10-24 22:42:14
---
This is Hacker Public Radio Episode 3398 for Wednesday, the 11th of August 2021.
Today's show is entitled, An Akron.
It is hosted by Klaatu and is about 16 minutes long and carries a clean flag.
The summary is, put down that gruntab and get started with An Akron.
This episode of HPR is brought to you by archive.org.
Support universal access to all knowledge by heading over to archive.org forward slash donate.
Everybody listening to Hacker Public Radio, my name is Klaatu and I'm walking back
from a cafe where I was just doing some work because I work remotely and that's a luxury
that I now have. It's quite nice. So I'm going to talk about An Akron, which is a really cool little
application that I'd kind of ignored for a long time because everyone talks about Kron all the time
and so you think Kron's the way to go. But it actually turns out that Kron can be a little bit weak
in some use cases, specifically a use case that involves rebooting a computer.
So Kron is kind of designed for servers really and it kind of assumes that your computer is on.
And if not all the time, I mean, I think it actually assumes that it's on all the time.
I think that would be a fair statement to make. But if not, then it kind of assumes
that it is at least on at certain times, namely the times for which you have scheduled a job to run
in Kron. And the first time that I butted up against to this was at a job where I had scheduled
backups to automatically run at like, I don't know, 3 a.m. or something. And inevitably
the computer systems in question were off at that time. And so backups just didn't run. And
you know, you can try little tricks like, okay, well, I guess the user turns their computer off at
11 p.m. every night. So I'll just make sure that my backups are running, you know, like at 8, that seems fair.
But then, you know, inevitably people change, people do different things and things get turned off.
So Anacron doesn't schedule things for specific times. Instead, it schedules things for specific
intervals. And so it knows, for instance, that if you scheduled a backup job or
or a batch job of any kind or, you know, something, you've scheduled something to happen.
And you want it really to happen every day. Hello, every day. Then Anacron
run will run the job one day. And let's say you go on holiday, turn your computer off for a
week, then you come back, turn your computer on. Anacron checks its schedule and sees that the last
time this job was, was executed was seven days ago. Well, it'll make sure that it gets run
that day. And maybe that wasn't a great example because I said you were doing it every day, so it
would do that no matter what. But let's say you wanted it every three days for some reason.
Then if you turned your computer off for seven days, when Anacron gets, when your computer's back
on, Anacron would run, it would see that the time since the previous execution was seven days,
not three. And so it would no matter what day it was, it'll run that job.
So that's the advantage of Anacron. Turn your system off. Turn your system on. Anacron checks.
When was the last time that this job was run? If it's greater than the time given to me in order
to execute it, I'll make sure that it's executed right now as close to that, you know, that time
range as possible. So Anacron's really handy like that. It's pretty easy to use too. You have to do
a little bit of setup because it may not automatically sort of have the infrastructure of that in place.
So you might have to set up a couple of directories, which I will go over even as I walk.
So first thing, you want to make a directory. In fact, a couple of directories. So
the dash P option to make parent directories where necessary would be very useful. So make
der dash P. And this goes in your home folder. It's your dot local slash Etsy slash
cron dot daily for instance. I guess you could probably call it Anacron dot daily. I'm
much sure. And then space because you're going to make another one in your home directory dot
vr slash spool slash Anacron. So the first one dot local slash Etsy slash cron dot daily.
That's where you're going to put the scripts that you want to run into or obviously you could
just simlink it into there or whatever. They need to be executable. So you want to do that.
But generally that's that's the one that you're really going to care about. The spool file is
just a spool file. It'll get used by Anacron. But you won't personally interact
directly with that. Okay, so that's that's a little bit of setup you've done. Now you're also
going to need a well an Anacron tab. You know, you have a cron tab for cron jobs. Well for Anacron,
you need an Anacron tab. And that's easy to make. You can do it in your local home directory.
Again, so you're going to make a directory in your home dot local slash Etsy slash. Well,
that would be it. And then make a file called Anacron tab. And in Anacron tab, you want a couple
of basic pieces of information. You want to put, you want to define your shell that you want
it to use. So shell equals slash bin slash sh or whatever you want to put there. Path equals
and give it the path you want Anacron to sort of be aware of. It's probably something like
slash S bin slash bin slash user bin and slash user S bin something like that. And finally,
you put down what you want to what you want it to be aware of. So for instance,
one space zero. So that's one day and zero minute delay cron dot daily. I guess you could
call it run dash parts slash home slash dot local slash Etsy slash cron daily. So it is
you're making it aware of the cron dot daily directory that you created.
And now that it's in the Anacron tab, it knows that on a daily basis, that is one and zero. So
one day and zero minutes delay. You want it to run everything in cron dot daily. Now for a weekly
job, you could make a directory called cron dot weekly. And you could put in your Anacron tab
seven space zero cron dot weekly run dash parts home dot local slash Etsy slash cron dot weekly.
And so on. And it doesn't have to be daily weekly. You know, it could be something else. It could
be daily every three days, seven days, every eight days, you know, whatever you whatever fits
for your schedule. But I think probably generally speaking daily and weekly, maybe monthly
would be appropriate. And now you know how to use those. And obviously, if you want for some
reason, you feel like there needs to be a delay before the cron before Anacron starts sort of
processing it scripts. You can add that delay in Anacron tab instead of that zero. Just add
some number of minutes to delay when Anacron sort of kicks in. Okay, save that. That's your Anacron tab
such as it is. And you can verify it. It has a little bit of a validation thing built in,
which is really nice. That's Anacron, Anacron, dash capital T, dash a lowercase T. And then the
path here Anacron tab, which is what was it dollars or not dollar till the dot local slash Etsy slash
Anacron tab. And then dash capital S for your spool file. And that of course was the thing that
you created way back in the beginning, you know, that tilde slash dot var slash spool slash Anacron.
That's it. Of course, when I say tilde, I personally, I give it the full path. I don't know why.
You can use tilde. I guess I thought I'd mention that I actually always give it the full path.
I get nervous about these things. Don't trust shortcuts. Okay, so that's a validation. If it comes
back with some error, you'll see the error pretty, pretty quickly. Well, hopefully, I mean, if you've
done what I've just read to you, there shouldn't be any errors. So it should be pretty obvious.
It's a pretty basic little Anacron tab. Okay, and then you need to add Anacron to some file
that gets reliably executed on your computer. This could be your dot profile file. It could be your
dot bash underscore profile or, you know, whatever, whatever you want to use. It could be an RC
local style file. I mean, that would be then you'd have to put everything in the various root paths.
But this is for your user. So I would probably just put it in my dot profile so that when you get logged
in, Anacron gets triggered. And the trigger that you're pulling here is Anacron dash capital,
no, dash lowercase t. And then a path to your Anacron tab, which again, slash home slash class
two slash dot local slash Etsy slash Anacron tab. And then a and dash capital S and the path to
your spool file, which is again, slash home slash class two slash dot dot var slash spool slash
Anacron. From there on, when you, you know, if you reboot or log back, log out and then log back
in whatever, um, pro dot your dot profile or whatever file you put it in should sort of get activated.
And the Anacron command runs. And if the thing that you were telling it to do hasn't been done
within the time allotted, in this case, one day, then it'll do it. Doesn't matter if it's 3am
or 10am or 2pm, it doesn't matter. If it hasn't, if it can't detect that the thing that you told
it to do was done a day ago by by Anacron. And since this is the first time you're setting it up,
it won't have, it won't detect that, then it'll do that thing. That's it. From now on, I mean,
that was all the setup. From now on, all you have to do is put a script into dot local or, you know,
till the slash dot local slash Etsy slash, no, no, what it was it slash, yes, cron cron dot daily,
you put your your scripts in there, then Anacron will always pick that up. And if you want to add,
again, like a weekly one, then just go through these steps again, except you're making cron dot weekly.
And then you're adding a cron dot weekly into your, into your Anacron tab as well. Really,
really easy. Like just after you get it set up, it's just, it's a no brainer. And it's just so nice.
It's really, really a great way to automate things without having to sort of juggle this decision
of like, when is, when is the computer actually going to be on? Well, you no longer care about that.
You just care that this thing will be, will be done on some predictable cycle of days. And yeah,
yeah, you might have a computer off of the weekend. And you might, you might instead of every three
days, it'll get run every four days because you turned your computer off and forgot to turn it
on at any point during the weekend. Not a problem. It'll pick it right up and restart the, the clock.
And it's pretty good. So that's Anacron, surprisingly more useful, I think, than cron actually is,
at least in terms of, in terms of personal computing. Maybe not on your server. Maybe that, you know,
cron works fine on your server. But for that, for that laptop or that desktop that's not necessarily
always aware, always awake. Anacron. Anacron's the way to go. I'm home now. So hopefully that has given
you an interesting and fun tip. Thanks for listening. I'll talk to you next time.
You've been listening to Hacker Public Radio at Hacker Public Radio. We are a community podcast
network that releases shows every weekday Monday through Friday. Today's show, like all our shows,
was contributed by an HBR listener like yourself. If you ever thought of recording a podcast,
then click on our contribute link to find out how easy it really is. Hacker Public Radio was
founded by the Digital Dove Pound and the Infonomicon Computer Club, and it's part of the
binary revolution at binrev.com. If you have comments on today's show, please email the host directly,
leave a comment on the website or record a follow-up episode yourself. Unless otherwise stated,
today's show is released on the creative comments, attribution, share a light, 3.0 license.