Making a system auto-update script that runs every 72 hours

So I got sick of gnome’s shit today. TLDGAF version is its buggy, has UI problems, and is over all just trash. Stop using gnome or attack them with bug reports or it’ll stay shit. Fucks sake. Now because of this I decided it was as good a time as any to install Void Linux to my desktop. A: I’ve been meaning to ever since I found it in december, and B: its a nice thing for me to learn on. At least for the most part.

Now, void is a staged rolling distro. Technically I can just install my apps through flatpak and never ever do xbps-install -Syu and it’ll never give a fuck. But I’m insane and want to keep relatively updated so this is where the thread title comes in.

How would I set it up so that I have a script that rolls on a timer of 72 hours, or IDK maybe a week, and it runs the update/install commands in the background AND it auto authenticates. I want to never think about it and never see it I just want it to do it. Is there a good resource to read up on this? I’m guessing its just bash scripting and learning how everything would fit together but I dunno.

And yes, I know you can set up a server to pull updates and shit, theres probably a docker image for that server, blah, but if I have to use SystemD for anything like this its a no go as void has runit. But, with that its easy to have the script start at boot. I just drop it in a folder and never have to think about it ever again!

So thanks for reading and if this is stupid tell me :stuck_out_tongue:

1 Like

Cron.

Predates systemd.

cron is a daemon.

You should be able to set up a cron job easily.

# 1. Entry: Minute when the process will be started [0-60]
# 2. Entry: Hour when the process will be started [0-23]
# 3. Entry: Day of the month when the process will be started [1-28/29/30/31]
# 4. Entry: Month of the year when the process will be started [1-12]
# 5. Entry: Weekday when the process will be started [0-6] [0 is Sunday]
#
# all x min = */x

ex. run every sunday at 2 am.

0 2 * * 0 /path/to/update_script.sh

Since this is a system update and will require ring 0 level access, you will need to run crontab as root. sudo crontab -e or call it as root.

Refer to the man pages.

Edit: had syntax backwards, thanks @Ruffalo

5 Likes

Wow I didn’t know thats what cron was for. Ok.

Are there differences in Cronie, dcro, and fcron? Or is it just different handles for things.

I am unaware of these, I’ve only ever used cron jobs. That’s what I learned in school. They may be aliases.

They be different daemons my guy.

https://www.voidlinux.eu/faq/#cron

Huh, interesting. Not surprised though, as cron is one of those ‘old’ commands that no one remembers. Only reason I know it is because I was taught by people who in the business when the business was good 20+ years ago.

I supposed just look up some examples for what you want to do and find one that is the easiest.

Glad I could help buddy! :slight_smile:

I find it very encouraging that we have active Linux users here who aren’t sysadmins, never had to learn basic system utils like cron, and yet got along fine. Makes me optimistic that the year of Linux on the desktop will come before I die of old age.

I do feel compelled to note that cron is not “an old command that no one remembers”. It’s absolutely essential and used every single day. Just not for desktop stuff.

Also one minor correction, your cron entry is backwards, the datetime numbers go on the left.

1 Like

I hear about cron all the time from JB I just never looked into it. I figured it wouldn’t be important for what I do.

@Dynamic_Gravity: Another minor correction, crontab -e opens an editor with the current user’s cron, it doesn’t open root’s cron unless you’re root when you run it. Each user has their own cron.

1 Like

Lol I just can’t win today.

1 Like

+1 for cron. On Fedora I use cron and the anacron for daily and weekly automation.

I remain hopeful, but I’m not sure there will ever be an overwhelming use of Linux desktop environments in every home and office.

@FaunCB has valid points in his OP. There are issues with Gnome that have been going on for a very long time, and the developers either don’t care or don’t want to fix the issues. Maybe they can’t? On Ubuntu Gnome, since 14.04, I have had plymouthd crash after launching the terminal shortly after boot. You can look at the bug reports and see that I’m not the only one, and it happens for multiple users in every iteration of Ubuntu, LTS and others.

The user interface still needs some work. Casual users and average users aren’t going to respond well to “RTFM”, which is another thing that needs work: The Community.

It’s easy to pick on Arch for having a toxic community, but it’s prevalent in all distro communities. The best we can do is try and outshine the bad seeds and instead of spamming links to the wiki when someone has a question, we can take time to help and answer their question, following up with “By the way, I learned all about this here: insert link to distro/package docs .”

1 Like

Dude, we still use cron in the biz. If anyone uses anything else than cron, it’s probably just a more convenient interface for cron.

Only deviation from that I ever saw was something called chronos that came baked into some application monitoring service we were using at my previous gig. Obviously inspired by cron, but the handling wasn’t quite the same, and it wasn’t OS level.

I’m sure there are tons of examples to the contrary, but I’ve found the Arch and particularly Ubuntu communities to be very friendly and welcoming. Obviously there’s a bit of “got a problem? Patches accepted” but that’s everywhere in open-source development.

I still remember them! Fucking saved my ass for automating LetEncrypt renewals.

1 Like

Now we hath certbot :grin:

Stopped using LetEncrypt now, got a Comodo wildcard ssl.

I too like like to live dangerously.

A post was split to a new topic: SSL Recomendations

I recommend starting an SSL thread since I garuntee you aren’t the only one with questions.

1 Like