You can add timeout to MClient as the fourth argument and remove Timeout.timeout block. By default it 600 for mcollective agent 'execute_shell_command'