In this case, I don't see the curl for the updateContext in the script. Strictly speaking, you don't need to update if previously to the script invocation the context element already exist in the DB. However, probably you should add the updateContext (with APPEND) at the beginning (i.e., before to start creating the ONTIMEINTERVAL subscriptions).