Visual Studio Code. VS Code is more than just a code editor, it provides the tools and extensions to.
I run a few things via cron, some of them need to run in intervals that cannot be expressed, for example biweekly or every 8th month.
As a general solution I created the every
command available here.
- TextMate grammars rely on Oniguruma regular expressions and are typically written as a plist or JSON. You can find a good introduction to TextMate grammars here, and you can take a look at existing TextMate grammars to learn more about how they work. TextMate tokens and scopes. Tokens are one or more characters that are part of the same program.
- Textmate is a super popular text editing and code handling app on Mac OS X that is beloved by many a coder.E supports Textmate snippets, bundles, version control, supports syntax highlighting for a ton of languages, has great search features, and can be used as a Unix scripting environment inside of Windows.There is a free trial while the full.
- TextMate is a versatile plain text editor with a unique and innovative feature set which caused it to win an Apple Design Award for Best Mac OS X Developer Tool in August 2006.
The supported usage is:
This will run command
every number
time it’s invoked. For example to send an email the third, sixth, ninth, etc. time we call it, use:
Using this in a crontab to remind us every second Wednesday could be done as:
How it Works
The command uses a guard file written to $XDG_DATA_HOME/every
. If XDG_DATA_HOME
is unset then it defaults to $HOME/.local/share
.
The name of the guard file is derived from the arguments passed to every
(using sha1) and the content of the guard file is a counter to keep track of how many times we have been called. As a convenience we also write the command to the guard file.
Once the counter reaches the value given via -n
then every
will remove the guard file and exec
your command.
Textmate Editor
The command is implemented as a bash script and should work on both OS X and GNU/Linux.
Alternative Solution
Textmate Mac
If the external guard file is undesired or readability is not a concern, then an alternative approach is to use modular arithmetic with the UNIX epoch returned by date +%s
. For an example see this post.