Results 1 to 4 of 4

Thread: CRONTAB doesn't use system variables

  1. #1

    Default CRONTAB doesn't use system variables

    Hi All,

    Please, can someone explains me How I can use scripts that recall system variables inside a crontab?

    I have something like as crontab file input
    #################################################
    # /home/giampiero/TO_BE_CROND/list.cron
    # Test di utilizzo di crontab
    HOME=/home/giampiero
    SHELL=/bin/bash
    * * * * * /home/giampiero/TO_BE_CROND/script > /home/giampiero/TO_BE_CROND/out 2>&1

    °°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°
    then I update it using:

    /usr/bin/crontab /home/giampiero/TO_BE_CROND/list.cron


    the script is like

    #!/bin/bash
    date >> $GHOME/date_test


    the output is

    /home/giampiero/TO_BE_CROND/script: line 4: /date_test: Permission denied


    The script driven by crontab doesn't recognize the system variable GHOME, I tried also inserting export and set without success

    Thanks in advance
    Giampiero

  2. #2

    Default Re: CRONTAB doesn't use system variables

    I solved inserting



    . /home/giampiero//.bashrc


    At the beginning of the script...
    I don't delete the post: maybe it will help someone else

  3. #3

    Default Re: CRONTAB doesn't use system variables

    -----BEGIN PGP SIGNED MESSAGE-----
    Hash: SHA1

    It may be worth mentioning that what you were after were environment,
    not system variables ('system' implies they are system-wide, which is
    not the case necessarily). Also, cron never keeps your environment
    variables, and typically that's not an issue since you can set them
    within the crontab as you did, though most people set them explicitly
    per their needs I think.

    Good luck.
    -----BEGIN PGP SIGNATURE-----
    Version: GnuPG v2.0.18 (GNU/Linux)
    Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/

    iQIcBAEBAgAGBQJPWOpnAAoJEF+XTK08PnB5VlMQAIs6oxoDbbrLVhhHaxPDVZfi
    d2P6ejtXftkfFmbpFNC5LWhD8xmW7+o4rEk8vDPlcIXMgmyQTDnGg73iNrZJPMbd
    iRl7Gbuz7bL1sydSDeEm12sKefLXdLyqjRPUGzWkQ/5WKJ3uVhHZDtD8j03SOVxb
    NxvZ1aUZ4nVkzfsaCYAV8hlicqlOkmGA+r28itJGd1Gqisj2UMGHgWiacLXLsRke
    8XqDYR4XrvQXebE9Y3b+/i7XvAeraRvjL63zpEfB2KZDJQPubuq+9fL8d+ovvsXE
    DclXuKonlq5+YZdC3DkA1YIGKA7FYDihutUT0cE3xQcKhX11UtFwW1ZayOfWjN87
    Dn3J/xDzF2qhm7Gf5bH7sxUOV2tO91N7yqhppuecvaHOwp7X2vtVDNHo463oNHwW
    +g7H5GRPqc/E4pj9sLoF/DXC0X8rTiDtC88fZNzOTteVw96gb4yxvu/AYg0oY/0/
    /t/pbaW/fP1YTLHp4lgzfT4egHxGVM78ynoi6hj8d+p8AwJLkw0lSUe9bPhKMvif
    zZKEX9r4P3N54thu67SN5b3P1TJWl/iT4Ud37o0xFiHvnCyAGfi+fdKh5pEa/uUE
    4eZgicwJlb0yCpAgZ8ExfX97BZhAocNTJAOnn26jB1G4uWYdAhm0mRIkh9/xhqAM
    dWO2u2f3hkFjwsRyHJqD
    =qLNH
    -----END PGP SIGNATURE-----

  4. #4
    Join Date
    Jun 2008
    Location
    Netherlands
    Posts
    24,890

    Default Re: CRONTAB doesn't use system variables

    And welcome here (I see these are your fisrt posts).

    Please next timm you post computer output use CODE tags http://forums.opensuse.org/english/i...ags-guide.html
    The effects are far better then posting bold as you did.
    Henk van Velden

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •