May Arduino execute sketch on power supply?

put everything in the setup and leave the loop empty

(explain better what you want to see when arduino is plugged in)