<commit_before># Warning

This **HAS NOT** been carefully vetted or tested, including for security concerns (particularly with other users injecting commands). Use at your own risk.

To the extent it has been tested, it was tested on Ubuntu Utropic.

# Why

There's no reason I should be writing this package, but there's *still* no reasonable way to test commands under cron. There's always some nonsense in the environment, you have to have it pipe stdout to a file and wait around for another minute like an idiot. And of course nothing happens for no apparent reason, so you try piping stderr...

So, here's a hacked up way to do it more conveniently:

# How To

In your crontab, add the following line:

    * * * * * python /path/to/package/debug_cron_server.py

Now wait until the next minute comes along. Yes this command will repeat every minute, but it should immediately exit if it's already running. Once it starts, it stays in a command loop so you don't have to keep waiting.

Now from within the package directory run:

    python debug_cron_client.py ls /tmp/somefile

You should get the output as cron sees it. Here, try this:

    python debug_cron_client.py env
<commit_msg>Requires Unix<commit_after># Warning

This **HAS NOT** been carefully vetted or tested, including for security concerns (particularly with other users injecting commands). Use at your own risk.

Requires (and should only be relevant for) a Unix environment. To the extent it has been tested, it was tested on Ubuntu Utropic.

# Why

There's no reason I should be writing this package, but there's *still* no reasonable way to test commands under cron. There's always some nonsense in the environment, you have to have it pipe stdout to a file and wait around for another minute like an idiot. And of course nothing happens for no apparent reason, so you try piping stderr...

So, here's a hacked up way to do it more conveniently:

# How To

In your crontab, add the following line:

    * * * * * python /path/to/package/debug_cron_server.py

Now wait until the next minute comes along. Yes this command will repeat every minute, but it should immediately exit if it's already running. Once it starts, it stays in a command loop so you don't have to keep waiting.

Now from within the package directory run:

    python debug_cron_client.py ls /tmp/somefile

You should get the output as cron sees it. Here, try this:

    python debug_cron_client.py env

{'fraction_non_alphanumeric': 0.05022458146182115, 'fraction_numerical': 0.0, 'mean_word_length': 3.969574036511156, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1388929', 'n_tokens_mistral': 671, 'n_tokens_neox': 622, 'n_words': 385}