a snap code for running task on the background for long period