I want to make a widget for the shell script, but the script stops automatically after a few minutes of execution

As shown in the figure, the function of the script is to output how long it is from now to the next day. After this setting, the script cannot be executed continuously. May I ask what to do to keep the script executed?

Every time I actively restart the software, the script will be executed automatically, but it will stop again after a few minutes.

I see that you are trying this for Touch bar, I do not have a touch bar, therefor tested the same script for a menubar item and so far it is working as expected for at least 15-20 mins. I think it will help Andreas if you can test this scenario (menubar item), this could eventually means that the issue is related to the touch bar if this happens only for touch bar.

What BTT and macOS versions are you using? Does the script stops working everytime around after a specific time period (e.g. after around 8mins) ?

if you want you can go to help-> export diagnostic debug information and send the result to me (andreas@folivora.ai), maybe there is an error logged.

I have sent the email. Thank you for your reply.

macos Monterey 12.7.4,btt 5.155。It only runs for about 2 minutes.In the picture I sent above, there is a run script now button on the right. Whenever the script stops running, I press this button to debug, and there is no result.

you need to purchase a license, the logs show you are currently using a pirated one. Your system has been flagged.
If you purchased that license from somebody you have been scammed.