Montecristo's cron command is a good way to schedule a job every 20 mins. As written, though, it will start a new instance of "command" without killing the old one. Nor does it place a record in "test1.log."
I assume the target program is named "#logdrift" (the leading hash is legal, but it presents some awkward escaping issues), and that you require exactly one instance of it running at all times.
Instead of having the cron entry run the target process directly, I'd create a simple wrapper script and execute that every 20 mins. Here, the wrapper would have 3 duties:
- To kill the running instance of the target process
- To start a new instance of the target process
- To make a record in test1.log
However, most programs shouldn't require a regular restart. Instead of throwing together a quick workaround like a cron job and wrapper script, it may be more appropriate to address the underlying problem.