I want to enforce timeout of 5s to python command and at the same time want to measure the execution time for python command (taking into account that python3 command memory limit is 256 MB), what I am doing is
ulimit -v 256000 && /usr/bin/time -f \"TIME: %e\" timeout 5s python3 test.py 2>&1
Above command is setting the virtual memory to 256 MB so that python3 command don't exceed above 256 MB, also I am measuring the time using /usr/bin/time and setting the timeout to 5s for python3 command.
I am in doubt that timeout is enforced on python3 command but the time command is put upon timeout as well as python3 command. But I want to set time only only python3 command. As above command will give time for timeout and python3 command execution but I want execution time for python3 command only.
Note: I want all of these actions to happenoccur in onea single line, as that is what I need. PLEASE HELPmy requirement.
If there are any command using which Icommands available that can doaccomplish the above thingstasks, that iswould also finebe acceptable.