In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-02-14 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >
Share
Shulou(Shulou.com)06/02 Report--
Do not know how to use linux's trap command to specify the action to be taken? In fact, it is not difficult to solve this problem. Let the editor take you to learn how to solve it. I hope you will gain a lot after reading this article.
The trap command is used to specify the action to be taken after a signal is received, and a common use is to clean up when the script is interrupted. When shell receives the signal specified by sigspec, the arg parameter (command) will be read and executed.
Syntax format: trap [parameters]
Common parameters:
-l have shell print a list of command names and their corresponding numbers-p print a list of commands associated with each signal. By default, each received sigspec signal will be reset to its value when it enters the shell-f blocks the interrupt signal.
Reference example
Clean up temporary files:
[root@linuxcool ~] $trap "rm-f $WORKDIR/work1 $$WORKDIR/dataout$; exit" 2
Ignore the signal:
[root@linuxcool ~] $trap''2
The default action to restore the signal:
[root@linuxcool ~] $trap 2
Stop the interrupt operation signal:
[root@linuxcool] $tail-f / var/log/test Thank you for reading this article carefully. I hope it is helpful for the editor to share the actions specified by linux's trap command. At the same time, I also hope you can support us, pay attention to the industry information channel, and find out if you encounter problems. Detailed solutions are waiting for you to learn!
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.