timeout cmd can throw an input redirection error in background mode. Replaced default timeout() with custom function delay()