Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

Use the timeout command of linux to kill the process if it should be run at the specified time

2025-02-24 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

Shulou(Shulou.com)06/02 Report--

This article mainly introduces the use of linux timeout command should be run at a specified time to kill the process, the article is very detailed, has a certain reference value, interested friends must read it!

The function of the timeout command is to run the specified command and kill the process if it is run after the specified time.

The timeout command is part of the GNU core utility package, which is installed in almost all Linux distributions. The suffix s stands for seconds (the default), m for minutes, h for hours, and d for days. If no units are added, the default is seconds. If the duration is 0, the associated timeout is disabled.

By default, timeout runs managed commands in the background.

Syntax format: timeout [parameters]

Common parameters:

Reference example

Send a SIGKILL signal to the ping command and terminate after 5 seconds:

[root@linuxcool] # timeout-s SIGKILL 5s ping www.linuxprobe.com

Run the command for one minute, and if the command does not end, it will be terminated after 10 seconds:

[root@linuxcool] # timeout-k 10s 1m sh linuxcool.sh

Run the command in the foreground:

[root@linuxcool ~] # timeout-- foreground 5m. / linuxcool.sh above is using linux's timeout command to kill all the contents of the process if it should be run at a specified time. Thank you for reading! Hope to share the content to help you, more related knowledge, welcome to follow the industry information channel!

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.

Share To

Servers

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report