News for hackers. Stuff that matters.
Re:BeGoneAds – A Python script that blocks ads by installing... by gumby on Monday June 10, 2019 @12:51PM (#20148441)
Isn’t that what cron is for?
Re:BeGoneAds – A Python script that blocks ads by installing... by josteink on Monday June 10, 2019 @01:54PM (#20149068)
Systemd has a cron system too.

I’m just guessing, but it might be easier to programmatically install a systemd cron job (and making sure it runs) than doing so for the old/conventional crond?

Re:BeGoneAds – A Python script that blocks ads by installing... by gumby on Monday June 10, 2019 @02:48PM (#20149558)
Just using cron is back compatible
Re:BeGoneAds – A Python script that blocks ads by installing... by Spivak on Monday June 10, 2019 @03:33PM (#20149974)
Things you get with systemd that you don't get with cron unless you implement them in the script.

* Not running if the network is down.

* Not running if the download path isn't available.

* Running if the machine was off during the scheduled time.

* Monitoring and retry logic.

* Logging to syslog.

* Resource constraints.

* Random wait.

It ends up being a lot of code factored out of the actual application.

Re:BeGoneAds – A Python script that blocks ads by installing... by behringer on Monday June 10, 2019 @05:04PM (#20150836)
so instead of code in one place you have it in 2?
Re:BeGoneAds – A Python script that blocks ads by installing... by JustSomeNobody on Monday June 10, 2019 @10:05PM (#20152545)
I don’t understand this logic. Can you explain why having code in more than one place is a bad thing?
Re:BeGoneAds – A Python script that blocks ads by installing... by behringer on Tuesday June 11, 2019 @11:25AM (#20156232)
For a simple script that does one thing, it's overkill.
Re:BeGoneAds – A Python script that blocks ads by installing... by josteink on Tuesday June 11, 2019 @01:18PM (#20157435)
Yes. So you keep that simple script simple, and you let systemd do the heavy lifting.
Re:BeGoneAds – A Python script that blocks ads by installing... by behringer on Tuesday June 11, 2019 @06:52PM (#20160234)
But systemd doesn't do any of the above listed things automatically... You'd need to write an entire script for sytstemd to take advantage of it. An entire script you could just have run with cron on boot.
Re:BeGoneAds – A Python script that blocks ads by installing... by naikrovek on Monday June 10, 2019 @03:27PM (#20149927)
He probably wants to learn more about systemd and needs/wants a project to do it.

Yes, obviously cron would work. If systemd can do what this dev needs, what's the harm?

Re:BeGoneAds – A Python script that blocks ads by installing... by anned20 on Monday June 10, 2019 @04:12PM (#20150345)
You're right, but I like the extensibilty of Systemd. Things like running every week or whenever the next start is. Or only if the network is online.