3

I am using linux server from cPanel. Now I need to use one of the linux command to run. And the command is 'timeout'. My command is something as below

$timeout 2s ./myexecutable < input > output

This is just running ok in my linux machine. But I want to run it in server(linux). But it is not running out there. I saw error log using 2>$1 . and it says command not found.

So how do I specify the path. That means how can I know the exact path to run it.

I am very new to this type of server stuff, so please don't be rude :D.. whatever you know please help me to get out of it. thank you

user2958359
  • 121
  • 1
  • 7
  • 15
  • 1
    The `timeout` command is probably not installed. See http://stackoverflow.com/questions/687948/timeout-a-command-in-bash-without-unnecessary-delay for some options on where to get it. If you know for sure it's installed but not where it is, try the `locate` command (`locate timeout`). Otherwise ask your server operator. – TypeIA Dec 12 '13 at 16:14
  • how to run locate command in linux server @DavidNorris – user2958359 Dec 12 '13 at 16:39
  • Do you control the server, ie have root access and/or shell access? Or is it a commercial server? If so, which one? If you have shell access, indicate results of `ls /usr/bin/locate` and `ls /usr/bin/timeout`. If no shell access, what do you have? – James Waldby - jwpat7 Dec 12 '13 at 16:52

1 Answers1

7

On Mac, you can use gtimeout from the coreutils package. To install it, run

brew install coreutils

If you need the command to be called "timeout" then you can alias it.

alias timeout="gtimeout"
Jesse Shieh
  • 4,660
  • 5
  • 34
  • 49