Skip to main content

cd and cron?

Comments

10 comments

  • quietFinn
    Try to use /usr/bin/cd instead of cd
    0
  • Dan Lester
    Try to use /usr/bin/cd instead of cd

    Nope. That doesn't work at all. That is, /usr/bin/cd ; cat x y > z doesn't work, but cat /home1/memyselfandi/mydirectory/x /home1/memyselfandi/mydirectory/y > /home1/memyselfandi/mydirectory/z does work Pretty annoying.
    0
  • cPRex Jurassic Moderator
    Can you let us know specifically what you're trying to do? I'm not sure that cron has an idea of a current directory, as it just reads the path you provide, so knowing more about what you're trying to do might help us provide a workaround.
    0
  • Dan Lester
    Well, I gave an example of what I'm trying to do. I want to put such a functionality in my cron command set. I want to schedule that functionality using cron.
    0
  • cPRex Jurassic Moderator
    Does your command work on the command line outside of cron? I don't see where your "cd" command actually changes into a directory.
    0
  • cPRex Jurassic Moderator
    If you really wanted to use "cd" you could create a bash script file and have cron call that, and I would expect that to work well.
    0
  • Dan Lester
    Yes, my command line works perfectly outside of cron. I guess I could call a script, but we're talking about just a short command line. Odd that cron can't handle it. Oops, good point. I meant /usr/bin/cd /home1/memyselfandi/mydirectory; cat x y > z doesn't work,
    0
  • cPRex Jurassic Moderator
    It looks like others have decided a script is the way to go for this:
    0
  • Dan Lester
    Points noted. Thank you. But you'd think all this would be spelled out in cron documentation. Also interesting that PATH delimiter doesn't seem to work in the cron instruction. As in PATH memyselfandi/mydirectory; cat x y > z
    0
  • quietFinn
    I think you are mixing PATH and HOME variables :rolleyes:
    0

Please sign in to leave a comment.