简体   繁体   中英

Is there any way to disable usb ports(Not ethernet ) on Raspberry pi 3b+?

I wrote a script for raspberry pi, I added my script to /etc/profile and my script saved in the pi home directory. My script is like a loop, It should not be interrupted using the keyboard or something. What is the best way to do this? Should I add some lines to stop someone from interrupting my script or disable USB ports(Not ethernet)?

I have tried "TRAP" but after pressing CTRL+C multiple times it is exiting from my script.

trap ' ' 2 3 6 15 INT TSTP

You can use stty to enable and disable the interrupt keys.

stty -isig # disable interrupt keys
# ... code that needs protecting
stty isig # enable interrupt keys

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM