Facebook Twitter Instagram
    TecAdmin
    • Home
    • FeedBack
    • Submit Article
    • About Us
    Facebook Twitter Instagram
    TecAdmin
    You are at:Home»General Articles»Where to set environment variables for crontab job

    Where to set environment variables for crontab job

    By RahulAugust 9, 20221 Min Read

    An environment variable contains a value that affects the runtime behaviors of applications. All the systems uses the environment variable that is accessible throughout the system. Some of the cronjobs required a few environment variables to set. This tutorial will help you to set environment variables in crontab jobs.

    Advertisement
    • The Debian-based systems use the vixie-cron its replacement mcron system, which allows declaring environment variables in the crontab file. For example:

      1
      2
      3
      4
      LANG=nb_NO.UTF-8
      LC_ALL=nb_NO.UTF-8
       
      * * * * * echo "Hello world"

    • The RedHat and Arch Linux systems use cronie that uses standard Unix crond daemon. This doesn’t allow for the declaration of environment variables in the crontab file. But, we can still use this with the crontab per entry:

      1
      * * * * * export LC_ALL=nb_NO.UTF-8;  echo "Hello World"

    Share. Facebook Twitter Pinterest LinkedIn Tumblr Email WhatsApp

    Related Posts

    Configure Postfix to Use Gmail SMTP on Ubuntu & Debian

    Deploying Flask Application on Ubuntu (Apache+WSGI)

    OpenSSL: Working with SSL Certificates, Private Keys and CSRs

    Add A Comment

    Leave A Reply Cancel Reply

    Advertisement
    Recent Posts
    • Configure Postfix to Use Gmail SMTP on Ubuntu & Debian
    • PHP Arrays: A Beginner’s Guide
    • Deploying Flask Application on Ubuntu (Apache+WSGI)
    • OpenSSL: Working with SSL Certificates, Private Keys and CSRs
    • How to Create and Read List in Python
    Facebook Twitter Instagram Pinterest
    © 2023 Tecadmin.net. All Rights Reserved | Terms  | Privacy Policy

    Type above and press Enter to search. Press Esc to cancel.