Run a command for a specified time and then abort if time exceeds
Clash Royale CLAN TAG#URR8PPP
up vote
41
down vote
favorite
I want know how I can run a command for a specified time say, one minute and if it doesn't complete execution then I should be able to stop it.
linux time timeout
add a comment |Â
up vote
41
down vote
favorite
I want know how I can run a command for a specified time say, one minute and if it doesn't complete execution then I should be able to stop it.
linux time timeout
add a comment |Â
up vote
41
down vote
favorite
up vote
41
down vote
favorite
I want know how I can run a command for a specified time say, one minute and if it doesn't complete execution then I should be able to stop it.
linux time timeout
I want know how I can run a command for a specified time say, one minute and if it doesn't complete execution then I should be able to stop it.
linux time timeout
asked Oct 23 '11 at 15:34
nikhil
4171616
4171616
add a comment |Â
add a comment |Â
1 Answer
1
active
oldest
votes
up vote
51
down vote
accepted
Use timeout
:
NAME
timeout - run a command with a time limit
SYNOPSIS
timeout [OPTION] DURATION COMMAND [ARG]...
timeout [OPTION]
(Just in case, if you don't have this command or if you need to be compatible with very very old shells and have several other utterly specific requirements⦠have a look at this this question ;-))
1
Perfect, thanks for linking to that question. I didn't have timeout on my system but I do now. Just on a side note, is timeout bundled with the majority of linux distributions?
â nikhil
Oct 24 '11 at 4:28
1
Pretty cool. you can do something like this:for i in `seq 0 3`; do timeout 2 ethtool -p eth$i; done;
to blink LED's on NIC's
â user1527227
Jun 19 '14 at 16:42
1
What a sexy command. Thanks for pointing it out, wasn't aware of it.
â Bruno Bieri
Mar 16 '17 at 14:16
add a comment |Â
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
up vote
51
down vote
accepted
Use timeout
:
NAME
timeout - run a command with a time limit
SYNOPSIS
timeout [OPTION] DURATION COMMAND [ARG]...
timeout [OPTION]
(Just in case, if you don't have this command or if you need to be compatible with very very old shells and have several other utterly specific requirements⦠have a look at this this question ;-))
1
Perfect, thanks for linking to that question. I didn't have timeout on my system but I do now. Just on a side note, is timeout bundled with the majority of linux distributions?
â nikhil
Oct 24 '11 at 4:28
1
Pretty cool. you can do something like this:for i in `seq 0 3`; do timeout 2 ethtool -p eth$i; done;
to blink LED's on NIC's
â user1527227
Jun 19 '14 at 16:42
1
What a sexy command. Thanks for pointing it out, wasn't aware of it.
â Bruno Bieri
Mar 16 '17 at 14:16
add a comment |Â
up vote
51
down vote
accepted
Use timeout
:
NAME
timeout - run a command with a time limit
SYNOPSIS
timeout [OPTION] DURATION COMMAND [ARG]...
timeout [OPTION]
(Just in case, if you don't have this command or if you need to be compatible with very very old shells and have several other utterly specific requirements⦠have a look at this this question ;-))
1
Perfect, thanks for linking to that question. I didn't have timeout on my system but I do now. Just on a side note, is timeout bundled with the majority of linux distributions?
â nikhil
Oct 24 '11 at 4:28
1
Pretty cool. you can do something like this:for i in `seq 0 3`; do timeout 2 ethtool -p eth$i; done;
to blink LED's on NIC's
â user1527227
Jun 19 '14 at 16:42
1
What a sexy command. Thanks for pointing it out, wasn't aware of it.
â Bruno Bieri
Mar 16 '17 at 14:16
add a comment |Â
up vote
51
down vote
accepted
up vote
51
down vote
accepted
Use timeout
:
NAME
timeout - run a command with a time limit
SYNOPSIS
timeout [OPTION] DURATION COMMAND [ARG]...
timeout [OPTION]
(Just in case, if you don't have this command or if you need to be compatible with very very old shells and have several other utterly specific requirements⦠have a look at this this question ;-))
Use timeout
:
NAME
timeout - run a command with a time limit
SYNOPSIS
timeout [OPTION] DURATION COMMAND [ARG]...
timeout [OPTION]
(Just in case, if you don't have this command or if you need to be compatible with very very old shells and have several other utterly specific requirements⦠have a look at this this question ;-))
edited Apr 13 '17 at 12:36
Communityâ¦
1
1
answered Oct 23 '11 at 15:41
Stéphane Gimenez
18.6k15074
18.6k15074
1
Perfect, thanks for linking to that question. I didn't have timeout on my system but I do now. Just on a side note, is timeout bundled with the majority of linux distributions?
â nikhil
Oct 24 '11 at 4:28
1
Pretty cool. you can do something like this:for i in `seq 0 3`; do timeout 2 ethtool -p eth$i; done;
to blink LED's on NIC's
â user1527227
Jun 19 '14 at 16:42
1
What a sexy command. Thanks for pointing it out, wasn't aware of it.
â Bruno Bieri
Mar 16 '17 at 14:16
add a comment |Â
1
Perfect, thanks for linking to that question. I didn't have timeout on my system but I do now. Just on a side note, is timeout bundled with the majority of linux distributions?
â nikhil
Oct 24 '11 at 4:28
1
Pretty cool. you can do something like this:for i in `seq 0 3`; do timeout 2 ethtool -p eth$i; done;
to blink LED's on NIC's
â user1527227
Jun 19 '14 at 16:42
1
What a sexy command. Thanks for pointing it out, wasn't aware of it.
â Bruno Bieri
Mar 16 '17 at 14:16
1
1
Perfect, thanks for linking to that question. I didn't have timeout on my system but I do now. Just on a side note, is timeout bundled with the majority of linux distributions?
â nikhil
Oct 24 '11 at 4:28
Perfect, thanks for linking to that question. I didn't have timeout on my system but I do now. Just on a side note, is timeout bundled with the majority of linux distributions?
â nikhil
Oct 24 '11 at 4:28
1
1
Pretty cool. you can do something like this:
for i in `seq 0 3`; do timeout 2 ethtool -p eth$i; done;
to blink LED's on NIC'sâ user1527227
Jun 19 '14 at 16:42
Pretty cool. you can do something like this:
for i in `seq 0 3`; do timeout 2 ethtool -p eth$i; done;
to blink LED's on NIC'sâ user1527227
Jun 19 '14 at 16:42
1
1
What a sexy command. Thanks for pointing it out, wasn't aware of it.
â Bruno Bieri
Mar 16 '17 at 14:16
What a sexy command. Thanks for pointing it out, wasn't aware of it.
â Bruno Bieri
Mar 16 '17 at 14:16
add a comment |Â
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f23145%2frun-a-command-for-a-specified-time-and-then-abort-if-time-exceeds%23new-answer', 'question_page');
);
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password