How to set a cron job on Skygear to run every 12 hours?
<p>Trying to set a cron job on my Skygear python cloud code, but not sure what I should enter in the decorator. I only know that it will work for units in second, but how to schedule a job to run every 12 hours? It is hard to calculate the seconds every time.</p>

<p>My code is like this, the function is to call a POST request:</p>

<pre><code>@skygear.every('@every 43200s')
def post_req():
    print ('scheduled to run every 12 hours')
    url = myurl
    ref = something
    r = requests.post(myurl, data = {'token':some_token, 'ref':something})
</code></pre>

<p>It actually works but is there some ways to write in a better format?</p>

<p>It seems like <code>skygear.every</code> also <a href="https://docs.skygear.io/cloud-code/guide/scheduled" rel="nofollow">accepts crontab notation</a>â¦ so <a href="http://crontab.guru/#0_*/12_*_*_*" rel="nofollow"><code>0 */12 * * *</code></a> could also do the trick.</p>

<p>Edit: Reading the <a href="https://github.com/robfig/cron/blob/master/doc.go" rel="nofollow">robfig/cron</a> docs, the best solution would actually be just <code>@every 12h</code></p>

python cron crontab cloud-code skygear