Find the answer to your Linux question:
Results 1 to 3 of 3
I am executing a php script from a cron job. The plain Jane scripts run just fine. Now I want to add a commena line argument to the script (argv[1]). ...
  1. #1
    Just Joined!
    Join Date
    Nov 2008
    Posts
    10

    argv in a Cron job

    I am executing a php script from a cron job. The plain Jane scripts run just fine. Now I want to add a commena line argument to the script (argv[1]). The script runs perfectly from the command line with the following syntax

    php myfile.php someargument

    But when I try to put this command in a cron job it doesn't seem to be reading the argv or I get an ioctl error.

    Any ideas on how to do this. I have been googling it for a day now and I haven't found anything useful.

    Thanks.

  2. #2
    Linux Newbie Ziplock's Avatar
    Join Date
    Jan 2009
    Location
    Adelaide
    Posts
    169
    I'm not sure that the shell inside cron would know where PHP lives. If you put in the full path to the PHP executable, instead of just 'php' does it make a difference?

  3. #3
    Just Joined!
    Join Date
    Nov 2008
    Posts
    10
    Quote Originally Posted by Ziplock View Post
    I'm not sure that the shell inside cron would know where PHP lives. If you put in the full path to the PHP executable, instead of just 'php' does it make a difference?
    It executes the script, just doesn't find the argv argument. Actually I have implemented a different approach. Instead of argv I have built a file that I can include which contains all the argv arguments.

    Thanks.

Posting Permissions

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