[GH-ISSUE #138] add custom hooks #108

Closed
opened 2026-03-02 23:38:03 +03:00 by kerem · 4 comments
Owner

Originally created by @muzzol on GitHub (Oct 14, 2020).
Original GitHub issue: https://github.com/alexal1/Insomniac/issues/138

this is a feature request to add possibility to execute custom scripts on certain events.

I was thinking of running Insomniac unnatended but I want to get reports and notifications in case something happens, for example receiving a telegram message.
Instead of hardcode any kind of notification a simpler and efective aproach is executing custom scripts on events like:

  • crashes
  • session finishes
  • new loop (--repeat)

my proposal is that when an event like this occurs it search for a script in src subdir, so if user creates a script like this:

/opt/Insomniac/src/crash.sh

it gets executed with some specific environment variables or parameters: date, number of interactions, number of likes, completed sessions, duration, path to crash zip file...

the script could be of any type: crash.(sh|py|pl)
with mentioned example there could be this scripts:

/opt/Insomniac/src/crash.sh
/opt/Insomniac/src/finished_session.sh
/opt/Insomniac/src/new_loop.sh

if no scripts are found, the tool just continues as usual.

Originally created by @muzzol on GitHub (Oct 14, 2020). Original GitHub issue: https://github.com/alexal1/Insomniac/issues/138 this is a feature request to add possibility to **execute custom scripts on certain events**. I was thinking of running Insomniac unnatended but I want to get reports and notifications in case something happens, for example receiving a telegram message. Instead of hardcode any kind of notification a simpler and efective aproach is executing custom scripts on events like: - crashes - session finishes - new loop (--repeat) my proposal is that when an event like this occurs it search for a script in src subdir, so if user creates a script like this: /opt/Insomniac/src/crash.sh it gets executed with some specific environment variables or parameters: **date, number of interactions, number of likes, completed sessions, duration, path to crash zip file...** the script could be of any type: **crash.(sh|py|pl)** with mentioned example there could be this scripts: /opt/Insomniac/src/crash.sh /opt/Insomniac/src/finished_session.sh /opt/Insomniac/src/new_loop.sh if no scripts are found, the tool just continues as usual.
kerem 2026-03-02 23:38:03 +03:00
Author
Owner

@muzzol commented on GitHub (Oct 16, 2020):

I've found another use case: when using emulator, sometimes it gets stuck and irresponsive so with a hook I can restart it.

<!-- gh-comment-id:709969614 --> @muzzol commented on GitHub (Oct 16, 2020): I've found another use case: when using emulator, sometimes it gets stuck and irresponsive so with a hook I can restart it.
Author
Owner

@muzzol commented on GitHub (Dec 11, 2020):

is there any progress on this feature?

<!-- gh-comment-id:743351127 --> @muzzol commented on GitHub (Dec 11, 2020): is there any progress on this feature?
Author
Owner

@Fadude commented on GitHub (Jan 6, 2021):

Done on v3.6.0

<!-- gh-comment-id:755244710 --> @Fadude commented on GitHub (Jan 6, 2021): Done on v3.6.0
Author
Owner

@muzzol commented on GitHub (Jan 30, 2021):

hi, I've found another use case.
sometimes my usb cable got disconnected on my headless setup, and I don't get any info about that as it runs in a raspberry with an attached mobile phone.

can you add on action notifications?

in my proposal I suggested simple names for script hooks that get executed if found.
so in this case it would be something like

  $INSOMNIAC_DIR/no_devices.sh

or maybe a generic error script hook would be enough. something like

  $INSOMNIAC_DIR/error.sh

this way I can send a notification or execute whatever I want on each action.

what do you think?

<!-- gh-comment-id:770266252 --> @muzzol commented on GitHub (Jan 30, 2021): hi, I've found another use case. sometimes my usb cable got disconnected on my headless setup, and I don't get any info about that as it runs in a raspberry with an attached mobile phone. can you add on action notifications? in my proposal I suggested simple names for script hooks that get executed if found. so in this case it would be something like $INSOMNIAC_DIR/no_devices.sh or maybe a generic error script hook would be enough. something like $INSOMNIAC_DIR/error.sh this way I can send a notification or execute whatever I want on each action. what do you think?
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/Insomniac#108
No description provided.