Issue on running a script while booting

Dear All,
I am using NVIDIA Jetson AGX Xavier. I want to run an script(as startup application) while booting the board. The shell script contains an exe application which captures the camera frame and save the frame. I have added the directory of my shell script in the end of bash_completion.sh file. The bash_completion.sh file is located at /etc/profile.d/bash_completion.sh. After rebooting my shell script is running and I can see the camera frames. But the challenge is I can not close the application.
I have already tried ctrl+c, ctrl+alt+z, ctrl+alt+Esc, Esc commands. But it does not work. Then I tried ctrl+alt+F2 which drops us to login page and then i can stop the application. But this is not my use case since I will not use any HDMI.

So my question is how can I stop the shell script while booting?

Any kind of help to solve this problem will be highly appreciated.

Best Regards
Anayat

I know nothing about the specifics of the case, but if it is a shell script, perhaps you could modify the script itself to know to exit under some circumstance? If not, then perhaps you could set up a trap for a signal, e.g., SIGINT, and the code executed in the script would be to exit. Here’s an article talking about that topic:
https://linuxhint.com/bash_trap_command/

Beware that there are many different signals, and SIGINT is just one which is typical for such an application (SIGUSR1 is perhaps also useful for this, whereas SIGINT is usually used to interrupt a program…but since your attempts are not interrupting, then maybe a new SIGINT trap would work). An individual user can send a signal to a process ID if the user owns that process (or if the user is root/sudo).

1 Like