Python script to perform an action based on conditions 1. connctivity 2. last known run