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 1s 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 1s 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 to happen in one line, as that is what I need. PLEASE HELP.