# Docker Compose for CRON job

**URL:** <https://discuss.elastic.co/t/docker-compose-for-cron-job/274087>\
**Category:** Elasticsearch\
**Tags:** docker\
**Created:** [May 26, 2021, 3:13pm UTC](https://discuss.elastic.co/t/docker-compose-for-cron-job/274087 "2021-05-26T15:13:29Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Ashish\_Jindal](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/ashish_jindal/32/46023_2.png) [@Ashish\_Jindal](https://discuss.elastic.co/u/Ashish_Jindal)\
**Post date:** [May 26, 2021, 3:13pm UTC](https://discuss.elastic.co/t/docker-compose-for-cron-job/274087/1 "2021-05-26T15:13:30Z")

</div>

We had a task to Create a docker file with ubuntu image

1. Create a print.sh file which has code to print date and time
2. Write a cron file named "hello-cron" which includes the print.sh to run for every 1 min.
3. The docker image should have a CRON job to print date and time every 1 min

We created a print.sh file via vi command and in it given as

```auto
#!/bin/sh -l
time=$(date)
echo "::set-output name=time::$time"

```

After which we had executed -

`chmod +x print.sh`

then tried as -

`* * * * * /home/scrapbook/tutorial`

Not sure where we went wrong, please guide us.

---

<div class="post-metadata">

**Author:** ![Christian\_Dahlqvist](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/christian_dahlqvist/32/4617_2.png) [@Christian\_Dahlqvist](https://discuss.elastic.co/u/Christian_Dahlqvist)\
**Post date:** [May 26, 2021, 3:33pm UTC](https://discuss.elastic.co/t/docker-compose-for-cron-job/274087/2 "2021-05-26T15:33:44Z")

</div>

How is this related to Elasticsearch?

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)\
**Post date:** [June 23, 2021, 3:34pm UTC](https://discuss.elastic.co/t/docker-compose-for-cron-job/274087/3 "2021-06-23T15:34:03Z")

</div>

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.
