# CRON tasks question : Newb tries to launch simple project RPi4+BalenaOS/Cloud+Screenly

**URL:** <https://forums.balena.io/t/cron-tasks-question-newb-tries-to-launch-simple-project-rpi4-balenaos-cloud-screenly/279332>\
**Category:** balenaOS\
**Tags:** support, docker, raspberrypi4\
**Created:** [March 29, 2021, 2:36pm UTC](https://forums.balena.io/t/cron-tasks-question-newb-tries-to-launch-simple-project-rpi4-balenaos-cloud-screenly/279332 "2021-03-29T14:36:44Z")\
**Posts on this page:** 1\
**Showing post:** 7

<div class="post-metadata">

**Author:** ![pesant](https://sea2.discourse-cdn.com/balena/user_avatar/forums.balena.io/pesant/32/5681_2.png) [@pesant](https://forums.balena.io/u/pesant)\
**Post date:** [April 2, 2021, 8:40pm UTC](https://forums.balena.io/t/cron-tasks-question-newb-tries-to-launch-simple-project-rpi4-balenaos-cloud-screenly/279332/7 "2021-04-02T20:40:52Z")

</div>

> Hey @pesant
> 
> Bienvenue 🙂 !
> 
> 1. Regarding setting the timezone in your application container, you can [set a service variable](https://www.balena.io/docs/learn/manage/serv-vars/#environment-and-service-variables) `TZ` with the [desired value](https://en.wikipedia.org/wiki/List_of_tz_database_time_zones).
> 2. As for setting up the cron job, you can possible achieve this with a cron task itself. I’m not sure how (and why) you would want to do it with celery?
> 
> You can find an example of a scheduler service [here](https://github.com/balenalabs/balena-dash/tree/master/scheduler). In the example it switches on/off the backlight on a PiDisplay. You would have to use the respective commands you specified
> 
> I hope this helps. Let us know

Hi @rahul-thakoor!  
Thanx to welcome me! 🙂

> Regarding setting the timezone in your application container, you can [set a service variable](https://www.balena.io/docs/learn/manage/serv-vars/#environment-and-service-variables) `TZ` with the [desired value](https://en.wikipedia.org/wiki/List_of_tz_database_time_zones).

Yep, I get it, saw it by myslef few days ago and related to that post below, another expert like you confimed too few hours after I changed my configuration.

> [@Timezone Troubles](https://forums.balena.io/t/timezone-troubles/122430/19):
>
> Hi Vipul, Thanx to answer back. I don’t really know if it works or not by creating TIMEZONE. First, I created an environment variable as mentionned in the doc (not sure to remember). Anyway, it wasn’t what I expected. I thought it changed my logs with the right timezone and something happenned because services stopped and automatically restarted. UTC switch turned to grayed and off and TimeStamps too but the good (for me) was reading as variable I guess.! I tried TZ to…

Concerning **cron task** , cron doesn’t work for me and because of that :

> **[Remotely turn on/off a connected TV](https://forums.screenly.io/t/remotely-turn-on-off-a-connected-tv/108/14)**
>
> Hi, I’m just getting back on this - I’m still new to Docker, please could you show me how to how to use Celery in setting up the task of turning on and off the TVs. This is my current setup: #Install cec-client $ apt-get install libcec3...

(at the end of discussion, specially from _ **vpertesson** _)

So, thank you to re-open reflections about it and considering that possibility…  
I have to try and adapt the code below to my wishes:

```
#!/bin/bash

if [! -z ${ENABLE_BACKLIGHT_TIMER+x}] && ["$ENABLE_BACKLIGHT_TIMER" -eq "1"]

then

  (crontab -l; echo "${BACKLIGHT_ON:-0 8 * * *} /usr/src/backlight_on.sh") | crontab -

  (crontab -l; echo "${BACKLIGHT_OFF:-0 23 * * *} /usr/src/backlight_off.sh") | crontab -

fi

crond -f

```

I also saw that too:

> [@Trying tom make schedule for turning on off display/HDMI](https://forums.balena.io/t/trying-tom-make-schedule-for-turning-on-off-display-hdmi/5967):
>
> i am new to balena and trying to add display turn on/off to a application. the service appers on the application and running but not working . ther error code i am getting is 10.04.19 12:51:18 (+0200) display /usr/src/start.sh: 7: /usr/src/start.sh: Syntax error: end of file unexpected (expecting “then”) have tried too google the problem but no distinct explanation what the trouble is. have added the Device Environment Variables DISPLAY\_OFF 43 12 \* \* \* DISPLAY\_ON 0 7 \* \* \* ENABL…

Could you send me a simple procedure to make it?

1/ create my own scheduler script with vsCode, Atom etc…  
a) start.sh ← cron job  
b) hdmi\_standby.sh ← CEC-CLIENT bash command  
c) hdmi\_on.sh

2/ push it on my device with Balena-CLI

Do I have to have another container docker as `scheduler` in your example or I have to modify an actual one (srly-\*)?

Thank you very much!

---

_[View the full topic](https://forums.balena.io/t/cron-tasks-question-newb-tries-to-launch-simple-project-rpi4-balenaos-cloud-screenly/279332)._
