r/linux_programming • u/Giuseppe_Puleri • Aug 04 '25
[ Removed by Reddit ]
[ Removed by Reddit on account of violating the content policy. ]
2
Upvotes
r/linux_programming • u/Giuseppe_Puleri • Aug 04 '25
[ Removed by Reddit on account of violating the content policy. ]
11
u/Background-Key-457 Aug 04 '25
I think you'd have to convince me why it's better than using a systemd service, rather than Cron.
10
u/Bitwise_Gamgee Aug 04 '25 edited Aug 04 '25
This is b/s and you know it.
cronis a clear case of "if it's not broken, why change it?". Cron is a scheduler, it does not need any features past what it has.That being said, your proposed cron replacement lacks the sufficient code review that a bit of kit that's been in service from the start of UNIX has. For instance, here are a few immediate problems:
getDaemonStatus()usesgrep -v+std::to_string(getpid()). This is fundamentally flawed.nanoCron.cpphasLogger* globalLogger = nullptr;which is a common mistake..nanoCron.cpp, there's a race condition inconfigWatcherwhen it's created as astd::unique_ptrand given a reference to the logger (see above). TheConfigWatcherstarts a background thread instartWatching(). The main loop then repeatedly callsconfigWatcher->getJobs(), however, there is no clear mechanism shown to ensure thread-safe access to the job list returned bygetJobs().nanoCron.cppiswhile (!shouldExit.load())checks the flag once every 20 seconds... If aSIGTERMis received, the daemon will continue processing jobs for up to 20 seconds before shutting down.There's more but these jumped out at me first... It's clear you are publishing AI slop and you lack the wherewithall to even proofread it.
edit --
On further review, I can't find many parts of your code that are written well, please delete your repo and try again.
Why?
5
u/EchoicSpoonman9411 Aug 04 '25
How is that remotely easier than crontab syntax? Your own example is ten times as much typing as:
0 2 * * * /usr/local/bin/backup.sh
3
u/grsftw Aug 06 '25 edited Aug 06 '25
I've been managing Linux and UNIX boxes since the before times. One benefit of crontab is the ability to "eyeball" conflicts in scheduling (e.g., this job should NOT run at the same time as THAT job because it will spike the CPU, etc). If you provide a way to see a crontab view while driving the underlying configuration via JSON, I think that has value.
Ask yourself what gaps cron has and fill those.
For example, vanilla cron lacks the ability to do sub-minute scheduling. That would be a value-add for some.
Another example is that cron, while easy to manage across a network because of
it'sits file-based configuration, is not inherently network-based but system-based. Is there benefit to a network-config driven cron? If so, that's a gap.Can you cron load-balance across servers to run the jobs where they need to be based on current utilization? A poor man's load balancing job scheduler? That's a gap. (Keep in mind this is a grey area shared with more advanced job schedulers that exists strictly to manage this.)
Again, I'd focus on the real gaps. You could have something.
1
u/chris17453 Aug 05 '25
I feel like that's a container