start and stop R interpreter automatically