# Running a specific julia environment from a crontab

**URL:** https://discourse.julialang.org/t/running-a-specific-julia-environment-from-a-crontab/58799
**Category:** General Usage
**Tags:** question, environment
**Created:** [April 8, 2021, 12:56am UTC](https://discourse.julialang.org/t/running-a-specific-julia-environment-from-a-crontab/58799 "2021-04-08T00:56:38Z")
**Posts on this page:** 4
**Page:** 1

<div class="post-metadata">

### Author: ![SpinolaHours](https://avatars.discourse-cdn.com/v4/letter/s/a3d4f5/32.png) [@SpinolaHours](https://discourse.julialang.org/u/SpinolaHours)
#### Post date: [April 8, 2021, 12:56am UTC](https://discourse.julialang.org/t/running-a-specific-julia-environment-from-a-crontab/58799/1 "2021-04-08T00:56:38Z")

</div>

Hi there.

My goal is to run a Julia script from crontab.

For this I need to be able to activate the correct Julia environment from the command line. I’m not sure how to do this.

A possible solution I’ve found is to add code to the startup.jl such as:

```julia
using Pkg
if isfile("Project.toml") && isfile("Manifest.toml")
    Pkg.activate(".")
end

```

Is this an appropriate/best solution?

---

<div class="post-metadata">

### Author: ![rdeits](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/rdeits/32/286_2.png) [@rdeits](https://discourse.julialang.org/u/rdeits)
#### Post date: [April 8, 2021, 1:14am UTC](https://discourse.julialang.org/t/running-a-specific-julia-environment-from-a-crontab/58799/2 "2021-04-08T01:14:38Z")

</div>

You can do:

```julia
julia --project=/path/to/your/project/folder script.jl

```

to run `script.jl` using the given environment.

---

<div class="post-metadata">

### Author: ![TheCedarPrince](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/thecedarprince/32/17323_2.png) [@TheCedarPrince](https://discourse.julialang.org/u/TheCedarPrince)
#### Post date: [April 8, 2021, 1:16am UTC](https://discourse.julialang.org/t/running-a-specific-julia-environment-from-a-crontab/58799/3 "2021-04-08T01:16:52Z")

</div>

In addition to @rdeits answer, you may also want to check out [DaemonMode.jl](https://github.com/dmolina/DaemonMode.jl) by @dmolina. It was designed with crontab use in mind. 🙂

---

<div class="post-metadata">

### Author: ![SpinolaHours](https://avatars.discourse-cdn.com/v4/letter/s/a3d4f5/32.png) [@SpinolaHours](https://discourse.julialang.org/u/SpinolaHours)
#### Post date: [April 8, 2021, 1:27am UTC](https://discourse.julialang.org/t/running-a-specific-julia-environment-from-a-crontab/58799/4 "2021-04-08T01:27:24Z")

</div>

Ah, nice. Much simpler!
