#1
  1. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Mar 2001
    Posts
    464
    Rep Power
    14

    Crontab: rewriting a file


    Hi,

    I need to recreate some php code files using the crontab. I already use the crontab to run several peices of php code for updating databases, but when I try to set up an entry for rewriting a php file I either get an error (stdin: is not a tty) or it does nothing at all.

    This is a rough up of what I'm trying:

    file1.php: this is the file to be rewritten

    file2.php: contains the php code for recreating file1.php
    the first line of file2.php is
    #!/path to php/php -q

    file3.sh: contains the line
    /path to file2/file2.php > /path to file1/file1.php

    In the crontab I have:

    10,30,50 8-16 * * * /path to bash/bash -login -c /path to file3/file3.sh &

    ============

    Hope someone can understand this!
    :-)
  2. #2
  3. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jan 2001
    Posts
    4
    Rep Power
    0
    >> stdin: is not a tty

    Because your option (--login) requires interactive. When it's interactive it doesn't read from stdin or ARGV.
  4. #3
  5. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Mar 2001
    Posts
    464
    Rep Power
    14
    Thanks for the reply freebsd.

    I tried removing the -login but the code was not run. As far as I can see the -login tells bash to act as a login shell allowing code to be run as if running it from the command prompt.

    Any other advice from anyone would be appreciated. Thanks in advance.
    :-)

IMN logo majestic logo threadwatch logo seochat tools logo