Forums

Always-on tasks does not always works

Hi there, I have a python script that sends a message to mobile numbers, of course it takes the numbers and time from the database. I assign it to Always-on task but it does not always works, nothing in the logs. Its state is always "starting" Please help me out. PS: Script works fine while executed from bash.

Moreover i notices that script got executed after each 5 minutes. Is it possible to make it execute every 10 or so seconds?

What do you see in your logs?

Always-on tasks are expected to run a code with something like while True loop. If the process exits it will wait longer each time between re-runs.

here is what i found in log..

Mar 24 14:27:44 sending message to diary

Mar 24 14:32:59 sending message to diary

Mar 24 14:38:05 sending message to diary

Mar 24 14:43:11 sending message to diary

Mar 24 14:48:19 sending message to diary

Mar 24 14:53:25 sending message to diary

Mar 24 14:58:35 sending message to diary

Mar 24 15:03:45 sending message to diary

Mar 24 15:03:45 message id is 1

Mar 24 15:03:45 Message successfully sent to +919817472837

Mar 24 15:08:53 sending message to diary

Mar 24 15:14:03 sending message to diary

Mar 24 15:19:16 sending message to diary

Mar 24 15:24:29 sending message to diary

Mar 24 15:29:39 sending message to diary

Mar 24 15:34:48 sending message to diary

Mar 24 15:39:59 sending message to diary

Mar 24 15:45:17 sending message to diary

Mar 24 15:50:19 sending message to diary

Mar 24 15:55:28 sending message to diary

Mar 24 16:00:34 sending message to diary

Mar 24 16:46:49 sending message to diary

and so on .......

this is a message i print while sending a message

It sounds like your script is written in a way where it just sends one message and then exits, rather than iterating over a set of messages from a database or waiting to see new messages in the database. Scripts that you run in an always-on task are just run, as if you did the command that you specified in a Bash console. If they exit, then they are run again after a timeout.

Thank you very much for your help. i got the point

No problem!