#!/bin/sh # redirect stdout and stderr to files exec >/tmp/stdout.log exec 2>/tmp/stderr.log # now run the requested CMD without forking a subprocess exec "$@"