cron job parameters only work for type "script"

Started by drosophila, April 09, 2026, 04:20:35 AM

Previous topic - Next topic
April 09, 2026, 04:20:35 AM Last Edit: April 09, 2026, 04:59:04 AM by drosophila
The type "script_output" doesn't pass on the parameters at all, while the type "stream_output" produces errors like those:
configd.py 24357 - [meta sequenceId="1"] [ed0118b6-cc66-4999-8f9f-ba9f9d59ced2] reordering IPv6 on interface re1...
configd.py 24357 - [meta sequenceId="2"] [ed0118b6-cc66-4999-8f9f-ba9f9d59ced2] Script action failed with [Errno 9] Bad file descriptor at Traceback (most recent call last):   File "/usr/local/opnsense/service/modules/actions/stream_output.py", line 70, in execute     callback(key.fileobj, mask)     ~~~~~~~~^^^^^^^^^^^^^^^^^^^   File "/usr/local/opnsense/service/modules/actions/stream_output.py", line 48, in stdout_reader     connection.send(data)     ~~~~~~~~~~~~~~~^^^^^^ OSError: [Errno 9] Bad file descriptor  (bytes processed 34)
configd.py 24357 - [meta sequenceId="3"] message ed0118b6-cc66-4999-8f9f-ba9f9d59ced2 [ipv6reorder reload re1] returned Execute error

The action file is this:
[reload]
parameter:%s
message:reordering IPv6 on interface %s...
command:/root/priorizeprivacy.sh
type:script
description:Reorder IPv6 addresses to priorize the PEA

The type "script" is the only one that works properly, but none of the other two.

What am I doing wrong this time?

Use script.

Cron doesn't process output anyway and both script_output and stream_output produce output.


Cheers,
Franco

April 09, 2026, 06:52:18 PM #2 Last Edit: April 09, 2026, 07:17:37 PM by drosophila
Thanks for the clarification! So that's why the log messages are truncated when using script_output. I've wasted several hours trying to find out why it wouldn't pass on the parameters like it should until I tried the other types. There's not much to be found about these cron jobs in conjunction with configd, and nobody uses parameters it seems, only a few (2, IIRC) internal scripts seem to so I kept thinking I'd missed the description of some special syntax that might be required. I did find an old thread (this one) where someone was successfully using the parameters with type script_output, so I expected the error was with my lack of understanding. I still seem to be missing something about the parameters / their syntax as the above script obviously works with type script_output while for me it just won't pass the parameter at all, I always get an empty parameter for $1.

So, since this is cleared up (in a way), can I use the internal interface aliases, like "WAN" in the cron parameters somehow, and if so, how? Would be really handy. :)