Crontab problems with run-part
I have been so proud of myself for setting up a cron job on my home server that automatically updates all of the packages installed on it. That way I don't have to think about it, because inevitably I will forget.
(A cron job is a program that run automatically at a particular time, usually a shell script but can be anything.)
Well, I just noticed that this has not been working. I added some logging into the scripts, I ran the scripts manually, and I Googled everything I could think of.
Nothing.
I could find nothing that told me why my scripts were not running.
I narrowed the problem down to a program call run-parts. It is a handy application that will run any executable file it finds in a folder.
So for example
run-parts /etc/scripts
would run all the programs it found in the scripts folder in etc.
Fair enough.
So why weren't my scripts running.
I confirmed that cron itself was running by adding a line to run my script directly, not through run-parts. I confirmed that run-parts could see the other scripts in the folders, but why not mine.
I finally turned to Microsoft's Copilot and asked it simply:
Why doesn't run-parts see my scripts?
The response:
The run-parts command might not be seeing your scripts due to the naming convention of the scripts. According to the run-parts man page, if neither the --lsbsysinit option nor the --regex option is given, then the names of the scripts must consist entirely of ASCII upper- and lower-case letters, ASCII digits, ASCII underscores, and ASCII minus-hyphens. In other words, the script names should not have any extensions.
You have got to be kidding me. run-parts can't handle a period in the file name? What? The file extension I added to the script files is what is messing it up?
Oh well, that is fine.
I will just change my file names and move on.
Granted, I got Copilot part of the way there with my Googling. I doubt that the answer would have been nearly as direct, but it is amazing that asking it a simple question gave me the exact answer.
We have to remember that these new chat bots, AI, LLMs, whatever you want to call them, are a model that gives answers based on data it sees from the world. But I am amazed at how it has a way of cutting through the clutter that a typical web search (whether that is Google or Bing or any other search engine you like) and pulling out the information I am needing.
Thank you, Copilot.
Comments