cron-manager command read env vars

How to read env vars in command section in schedules.json file in cron-manager.

Here’s the test json I am using

    "name": "test-job",
    "app_name": "cron-manager-test-komal",
    "schedule": "* * * * *",
    "region": "ord",
    "command": "echo ${HELLO_WORLD_TOKEN}",
    "command_timeout": 60,
    "enabled": true,
    "config": {
      "metadata": {
        "fly_process_group": "cron"
      "env": {
        "HELLO_WORLD_TOKEN": "test_token"
      "auto_destroy": true,
      "disable_machine_autostart": true,
      "guest": {
        "cpu_kind": "shared",
        "cpus": 1,
        "memory_mb": 512
      "image": "curlimages/curl:8.7.1",
      "restart": {
        "max_retries": 1,
        "policy": "no"

It just prints - ${HELLO_WORLD_TOKEN} right now

Hey there,

To answer your question directly, you can do something like this:

command: "printenv \"HELLO_WORLD_TOKEN\"" 

This is pretty limiting though and escaping complex commands can be pretty annoying. That being the case, I would recommend creating a custom image that holds your pre-defined scripts and use the command field to call them directly.

Let me know if you have any additional questions and or feedback on this.

1 Like

From General to Questions / Help

Thanks for this.

This works but for simple commands like curl, it would be great if we could have it in json command param itself

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