# Cron name available in pipeline

**URL:** https://drone.discourse.group/t/cron-name-available-in-pipeline/11652
**Category:** Drone Support
**Created:** [February 11, 2022, 10:14pm UTC](https://drone.discourse.group/t/cron-name-available-in-pipeline/11652 "2022-02-11T22:14:47Z")
**Posts on this page:** 3
**Page:** 1

<div class="post-metadata">

### Author: ![spar](https://avatars.discourse-cdn.com/v4/letter/s/b9bd4f/32.png) [@spar](https://drone.discourse.group/u/spar)
#### Post date: [February 11, 2022, 10:14pm UTC](https://drone.discourse.group/t/cron-name-available-in-pipeline/11652/1 "2022-02-11T22:14:47Z")

</div>

I’m trying to run pipelines against a repo using a nightly schedule. I would like to run different pipelines at different times, however I am coming up short as to how to distinguish them. I can pass the DRONE\_BUILD\_EVENT variable in to determine that this is a cron event, but I want to have a couple of different cron jobs that run where different actions are taken. I see that you can name the cron jobs when using the cli/api. Is the cron name available in an environment variable for the pipeline to use? Are there any other ways that you can provide to accomplish this?

---

<div class="post-metadata">

### Author: ![drone](https://yyz1.discourse-cdn.com/flex003/user_avatar/drone.discourse.group/drone/32/6956_2.png) [@drone](https://drone.discourse.group/u/drone)
#### Post date: [February 12, 2022, 1:09am UTC](https://drone.discourse.group/t/cron-name-available-in-pipeline/11652/2 "2022-02-12T01:09:13Z")

</div>

> [@spar](#):
>
> I would like to run different pipelines at different times, however I am coming up short as to how to distinguish them.

you can specify that a pipeline should only execute for a named cron job using the _trigger_ block:  
[https://docs.drone.io/pipeline/docker/syntax/trigger/#by-cron](https://docs.drone.io/pipeline/docker/syntax/trigger/#by-cron)

or you can specify that individual steps should only execute for a named cron job using the _when_ block:  
[https://docs.drone.io/pipeline/docker/syntax/conditions/#by-cron](https://docs.drone.io/pipeline/docker/syntax/conditions/#by-cron)

the name of the cron job is also available to your pipeline steps via the `DRONE_BUILD_TRIGGER` environment variable.

---

<div class="post-metadata">

### Author: ![spar](https://avatars.discourse-cdn.com/v4/letter/s/b9bd4f/32.png) [@spar](https://drone.discourse.group/u/spar)
#### Post date: [February 18, 2022, 8:47pm UTC](https://drone.discourse.group/t/cron-name-available-in-pipeline/11652/3 "2022-02-18T20:47:13Z")

</div>

> [@drone](#):
>
> DRONE\_BUILD\_TRIGGER

Thanks for the info, Brad. I was playing around with this and I’ve found that the DRONE\_BUILD\_TRIGGER environment variable is always blank for cron jobs with names. I’m going to pursue the when/trigger block, but wanted to follow up on the DRONE\_BUILD\_TRIGGER environment variable. I didn’t find this anywhere in the docs either. Do I need to be at a specific version or any other requirements for this value to be present?

Thanks again!
