Results 1 to 6 of 6
  1. #1
    Join Date
    Jan 2005
    Posts
    7

    Unanswered: How to change the invoking shell for CRON (from sh to csh) ?

    Hi all,

    I need to make cron process use csh instead of standard sh when invoking a crontab entry.

    Cron process uses sh:

    mxtest 7299 566 0 14:46:00 ? 0:00 sh -c $HOME/mytest.csh
    mxtest 7300 7299 12 14:46:00 ? 19:28 /bin/csh -f /export/home1/mxtest/mytest.cs

    I added "SHELL=/bin/csh/ in /etc/default/cron but no effect...

    Thks a lot,
    Marco

  2. #2
    Join Date
    Apr 2004
    Location
    Boston, MA
    Posts
    325
    would it it be more natural to specify the shell interperter to INSIDE any of your csh scripts?

    like so for 'mytest.sh':
    #!/bin/csh
    echo "here's my ${0}"
    vlad
    +-----------------------+
    | #include <disclaimer.h> |
    +-----------------------+

  3. #3
    Join Date
    Jan 2005
    Posts
    7
    Unluckly no: in my scripts I'm already specifying what you suggest, so the executing shell is csh, but the involking shell (parent) is sh if run from crontab.

    This is what I want to avoid...

    sh =>
    mxtest 27109 4054 0 15:26:00 ? 0:00 sh -c csh -c "$HOME/prova.csh"

    csh =>
    mxtest 27110 27109 0 15:26:00 ? 0:00 csh -c /export/home1/mxtest/prova.csh

    csh =>
    mxtest 27115 27110 4 15:26:00 ? 0:03 /bin/csh -f /export/home1/mxtest/prova.csh





    Thks,
    Marco

  4. #4
    Join Date
    Jun 2003
    Location
    West Palm Beach, FL
    Posts
    2,713

    Cool

    Set default shell in /etc/passwd like:

    myid:x:222:66:My User Id:/home/MyHome:/bin/csh

    Or, make first statement in "$HOME/prova.csh" to be: #!/bin/csh and in crontab invoke like this:

    00 01 * * * /home/MyHome/prova.csh

    Last edited by LKBrwn_DBA; 01-24-05 at 14:30.
    The person who says it can't be done should not interrupt the person doing it. -- Chinese proverb

  5. #5
    Join Date
    Apr 2004
    Location
    Boston, MA
    Posts
    325
    'man crontab'

    The shell is invoked from your $HOME directory with an arg0
    of sh.
    vlad
    +-----------------------+
    | #include <disclaimer.h> |
    +-----------------------+

  6. #6
    Join Date
    Jan 2005
    Posts
    7

    This Answers

    crontab man page answers my question

    thks

    Marco

Posting Permissions

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