Those are all database functions. In UNIX/Linux, each configuration file has its own mechanism for all that. They're all inferior to SQLite.
Those are all database functions. In UNIX/Linux, each configuration file has its own mechanism for all that. They're all inferior to SQLite.
Most of the things living under /etc are not databases. crontab certainly isn't:
- Only a single "table" (no table-relations)
- No standard database type exists for columns (how would you model the scheduling as database types, how would you model the shell command as database types, if not simply as sanitized strings)
So you can't get integrity for free. Need a custom parser and some integrity checks. Not so difficult (yes, cron will give instant feedback for the unlikely case that you did something wrong)
Re: editor, locking, access control:
I have an editor and prefer it to writing SQL DML any day.
File updates (rename(2)) are atomic, so no need for additional locking. And even if there is some broken tool writing to the old file instead of rename, the chances of that being simultaneous with a parse are microscopic. Don't overdesign. (there are many more things that can go wrong in a system that you can't possibly design out. Live with it).
Access control: Standard file permission modes are just fine. More complex permission model would be a serious overdesign. You can get granularity by using separate crontabs.
Checker: Never needed an additional tool to format the meaning as human-readable text. The syntax is a bit ugly but quite easy to remember and use.
Someone edits a cron file in the most common editor, vim. On many systems it doesn't do an atomic swap on save without extra configuration: http://stackoverflow.com/questions/13563627/how-does-vim-sav...
Now maybe your unresponsive, undergoing swap, system misses a cron job that was present in both edits. Opps.
I'm not sure this could really play out, but the approach definitely sounds firmly on the "worse is better" side of the scale.
Otherwise adding a file or deleting a file in /etc/cron.d/ is the way to go for automatic(ansbile, puppet etc) and package installations.
However crontab -r has to be one of the most poorly thought out commands in UNIX. It removes the cron file and since r is only one character over from e on qwerty keyboards it's a painful and surprising typo.
Instead of per-user crontabs. Much easier to manage.
With cron.d you can specify what user each cron entry should run as, so it is equivalent.
2. Puppet handled that parsing for you and will throw errors if your syntax is wrong
Honestly though, I never use `-e` either. I keep a ~/.crontab and edit that, and then `crontab ~/.crontab`.
Voila, backup/time machine/git friendly crontab.
And there's "vipw" for the password file. Each of them with their own separate updating bugs.
Nobody argues that there can't be problems. What all critics miss is to show how to avoid these problems.
What can you do about jobs that make the system unresponsive? Not a problem for cron to solve.
If someone writes a crontab (instead of rename()ing another version over it), that's not cron's fault. Sqlite databases can be just as easily corrupted or lose integrity. Now which format would you rather repair?
Missing a cron job can not be totally avoided, and it isn't the end of the world. What if your machine goes down or cron crashes? The answer is that the jobs themselves have to be provided with some resilience against that situation.
This isn't a case of "worse is better" since there weren't proposed solutions to the "problems" at all, however unrealistic.
Editor: of course you need some way to input data, and an editor is the simplest interface. You need to generate SQL to store data in SQLite and that's certainly not simpler.
Locking system: the OS/filesystem can provide this just as well as a database can.
Access control: same answer
Checker: input needs to be validated for its intended task and SQLite won't magically make this requirement disappear.
Or did we not read the manual, then complain about broken stuff and follow that with an over-enginered "solution" to a problem that didn't exist.
The syntax of cron isn't the most intuitive but it's powerful and would make even less sense in a database.
Also the tools argument just isn't true. A well designed plain text format is easier to parse with a one-off parser than with ugly one-off SQL queries. The reason that not many GUIs exist for plain text formats is that they are already designed to be easy to use. There are few cases where GUIs make sense.
From the top of my head, the only configuration GUI I regularly use is firefox's. Not that it wouldn't be possible to come up with a clean plain text design that would be easier to use.
Also most of the stuff is not represantable as relations. I'm looking forward to see how you encode a shell command in relations.
I don't think a database would offer anything unless it was managing 1000's of cron servers. Flat text is fine and easier to parse than querying a database and adding a dependency. A database is a huge requirement to ask for to manage a few simple files.
It's not like crontabs are written all the time. They don't need to be so terse. They shouldn't require learning a language... they shouldn't require a cron.guru website. Systemd timer syntax (https://wiki.archlinux.org/index.php/Systemd/Timers#Example) is far more readable, and there's still a lot of room for improvement.
Unix programmers aren't in the habit of throwing out a working system because it's hard to grok, nor building something more complex then it needs to be. I took a look at your systemd timers link and it is a more complex syntax to create the same effect. From their own caveats section:
> Complexity: to set up a timed job with systemd you create two files and run a couple systemctl commands. Compare that to adding a single line to a crontab.
I've spent the past years doing that. I do understand cron. I also strongly dislike it. You could build a thriving city within the bounds of the room there is for improvement.
> It even handles that crazy case where you want to run on a specific day of the week.
So does systemd's cron. Supporting "crazy cases" doesn't mean the syntax has to suck.
> Cron lines may seem arcane at first, but then again have you ever tried to write code that was timezone aware?
Yes...
Re systemd: It's one example; it's not perfect, I wouldn't even call it good, but it's leagues ahead of cron in terms of UX already. Bonus: usage of the ini format means it's programmatically much easier to interact with the cronjob itself.
But a simple GUI could take care of that.
appstartup.sh | tee -a app.`date +%Y%m%d`.logWhy is having the format be so concise and terse a virtue?
They could keep the flat file approach and everything about the system identical but just make it more explicit. Cron usage would become much simpler.
Does it handle the, in my opinion, not crazy case of running something every, say, 100 seconds?
*/1 * * * * /usr/bin/bash -c '[[ $(( $(/usr/bin/date +%s) % 6000)) -eq 0 ]] && mycommand'But you probably can tweak your requirement slightly.
@100 /do/my/thing.shWatch your language!
*/100 * * * * echo "every 100 mins"I have a similar problem with "every 2 days". */2 looks simple enough, but it fires on the 29th, miss 30th, fires on 31st, then fires the 1st. 3 times in 4 days isn't "every 2 days".
Cron only works for periods which are evenly divisible into the calendar. "every 7 minutes" doesn't work because 60 isn't evenly divisible by 7. "every 5 hours" doesn't work (in that it'll match 8pm and midnight, which are only 4 hours apart), etc.
Cron ticks every minute and checks to see if any crontab entries match the current time, if so it runs the job. But standard regular expressions aren't well suited to the types of patterns people normally try to express which is why they use their own syntax.
Cron could be considered as a good mix between complexity and brevity (readability).
Shameless plug: I tried to create a format in-between both in a JS project [1]. It is based on the ISO 8601 duration format [2], but it's better to stick to iCalendar.
[0] https://tools.ietf.org/html/rfc2445#section-4.3.10
http://pubs.opengroup.org/onlinepubs/7908799/xcu/crontab.htm...
In a sense, crontabs are the lowest common denominator for scheduling tasks on POSIX-compliant systems.
Killing off old designs is exceptionally difficult for Unix. Hell, Microsoft can barely force an upgrade on everyone and they don't have a hundred forked distros.
The configuration system absolutely demands the locking system (to alter it) and the checker (to correctly check if it is correct before the changes are ever committed). SQLite can provide some of them, but not all---most importantly, SQLite's locking system is independent of the runtime configuration which requires separate locking system (however rudimentary).
In UNIX, everything is a file
Do you see a pattern?
Create a process in the same manner. Oh, again you can't do that. What a shame.
And with route and user account examples you confuse being a file and being a record in a file (which, couriously, is not a file itself).
Granted, it's not possible to change IPv6 address through /proc/net/if_inet6, but just because I don't know about it, doesn't mean that it isn't possible.
No. It's a configuration file for a separate set of tools that actually configure the interface for you. You can't set its current IP address by writing to any file.
> I can set tx queue length of eth0 to 300 packets: echo 300 > /sys/class/net/eth0/tx_queue_len Or change frame forwarding behavior from switch to hub: cat 0x65535 > /sys/class/net/vnet0_11/bridge/group_fwd_mask
Sorry, no banana; you only can control two or three aspects this way, and not the most fundamental ones at that.
Network interface is simply not a file, it's a separate OS-level construct, it's not exposed to userland as a file. Not everything in Linux or unix is a file, even though many things (the ones more remote from kernel) are.
Just because Windows' registry is hard to manually edit doesn't mean they are a bad idea. Look at how much better Windows' GUI configuration tools are than anything on Linux. They all use the registry.
An associated problem is that the registry accretes trash that is never weeded out (and it's hard to weed it out).
Also at least in former times it was slow (partly because of the trash thing, probably partly because of the implementation, partly because of the centralised design).
> ...accretes trash
If your app doesn't remove it's old settings when uninstalled how is that a problem for the registry to solve? It happens with /etc also.
> hard to weed it out
Search for the hives if you don't know where they are. Right-click the hives in question, delete.
Registry usability got leaps and bounds better in Windows 7, and again in Windows 10. Most registry problems you hear about are holdovers from the bad old days (XP and older).
with reg query, reg export and reg import commands, respectively. Or with a few clicks in the GUI, if you prefer.
That's not the problem with Windows registry.
> That's not the problem with Windows registry.
What is?
> My life would be a heck of a lot easier if per-application settings were stored in a place I could easily see them, manipulate them, and back them up. Like, say... in INI files.
> The registry is opaque and binary. As much as I dislike the angle bracket tax, at least XML config files are reasonably human-readable, and they allow as many comments as you see fit.
Now look at the comment you replied to:
> Just because Windows' registry is hard to manually edit doesn't mean they are a bad idea.
You said that's not the problem with the registry, but your own link says that's exactly the problem with the registry...
Which itself has all sorts of complications around locking. Can't write when another process has read-only lock, for example:
Makes sense.