Truncate the home-assistant.log file Using a Shell Command

How to repeat an action until another (specific) device trigger is received in home assistant