Hotplug.d scripts

Hi
I am building openwrt image with coova chilli disabled at startup.
while i have this script in /build_directory/files/hotplug.d/ntp/90-chilli
which is

#!/bin/sh
	/etc/init.d/chilli start

after upgrade i get this on serial console.

Syntax: /etc/init.d/chilli [command]

Available commands:
        start           Start the service
        stop            Stop the service
        restart         Restart the service
        reload          Reload configuration files (or restart if service does not implement reload)
        enable          Enable service autostart
        disable         Disable service autostart
        enabled         Check if service is started on boot
        running         Check if service is running
        status          Service status
        trace           Start with syscall trace
        info            Dump procd service info

i am doing this because i need to wait until ntp sync date and time, so chilli starts with correct date/time.

it was working with me before i was using openwrt-22.03.0
now with 22.03.5 and 23.05.2 the builded image gives this out to the console.
and chilli won't start.

Any Idea ?

i disable chilli startup by commenting out START=90 from
/build_directory/feeds/packages/net/coova-chilli/files/chilli.init

Why not put the call into /etc/rc.local after init runs?

/build_directory/files/etc/hotplug.d/ntp/90-chilli

not /build_directory/files/hotplug.d/ntp/90-chilli. With etc.

2 Likes

@cezary
Sorry i mistyped it .
it is already in /build_directoryfiles/etc/hotplug.d/

is it 100% that ntp sync happen there ?
Nope.
if there is not internet connection, then ntp won't sync, then chilli will start with wrong date/time.

is it 100% that ntp sync happen in init?
Nope.
But a sleep before the call in rc.local should get you there.

Are you sure your hotplug script is triggered? I don’t see a loggercall.

Hi

i was avoiding shebang in hotplug scripts my whole life :slight_smile:

maybe you could try something like this in rc.local

#!/bin/sh
sleep 60 && /etc/init.d/chilli start > /tmp/log_startup 2>&1 &

this will give you enough 60 sec time for things to settle down
and it will not stop any other startup sequence because cmd is running in background
furthermore, you will have /tmp/logxxxx to see what happened on startup

1 Like

yes it is,

Syntax: /etc/init.d/chilli [command]

Available commands:
        start           Start the service
        stop            Stop the service
        restart         Restart the service
        reload          Reload configuration files (or restart if service does not implement reload)
        enable          Enable service autostart
        disable         Disable service autostart
        enabled         Check if service is started on boot
        running         Check if service is running
        status          Service status
        trace           Start with syscall trace
        info            Dump procd service info

the thing is, i noticed that when i only edit enter empty line to the 90-chilli file and save it. and reboot, it works as expected..
that is certainly related to text editor i am using in ubuntu. maybe encoding issue.

i will copy it to build dir and i am pretty confident it is the solution.

@NPeca75
you can never be sure that ntp sync occured, you have to trigger the start of chilli after ntp sync happen.

well, it is then, again, wrong approach ...
ntp hotplug will be called on various events

for ex:

if [ "$ACTION" = "stratum" ] || [ "$ACTION" = "step" ]; then
    ---DO SOME STUFF HERE ---
    logger -t NTP "HOTPLUG: date updated-> $(date)";
fi

so i am not sure what will chilli startup say at subsequent firing up

@NPeca75
i don't know,
i never had an issue with that approach.

always delay chilli startup after ntp sync happen.
and if there is not internet connection. it never starts.

That makes me to suspect that there is a hidden char or similar, as the start command is not recognised.

(In any case, you might use "restart", so that multiple calls can be handled.)

1 Like

that's it...
i never had an issue with ubuntu text editor before.
found out the the end of line is CRLF not LF as Unix-style line endings
i do not know how this happened.

Hidden chars (including Linux/windows cr/lf differences) is surprisingly common, and can be hard to detect/recognise. And some file transfer tools even try to help you by adding/removing cr automatically...

The nastiest example of a hidden char that I have seen, is hidden char entered into u-boot env variable name, destroying sysupgrade...

2 Likes

i think this could trigger chilli to restart and kick out authenticated users.
it is best to use start command. as executing start again while it is already started.
it won't kick no body, simply would do nothing.

This topic was automatically closed 10 days after the last reply. New replies are no longer allowed.