SitePoint Sponsor

User Tag List

Results 1 to 10 of 10
  1. #1
    SitePoint Addict
    Join Date
    Jun 2007
    Posts
    358
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    php through crontabs

    hi,

    Currently i am using lynx -dump http://domain.com/script.php. I need it to send me e-mail of the output for testing purposes, which the command already does. However, after I finish the site (in a week or two) I would no longer need e-mail output. I read somewhere that adding -q will execute the php but not send e-mail of the output. But when I tried lynx -dump -q http://domain.com/script.php, it showed error and provided list of availiable commands etc..

    Can someone tell me how to disable e-mailing output for lynx -dump http://domain.com/script.php? Thanks.

    I know this is not directly php related, but many people using php would have dealt with this one time or the other.

  2. #2
    SitePoint Wizard spence_noodle's Avatar
    Join Date
    Jan 2004
    Location
    uk, Leeds (area)
    Posts
    1,264
    Mentioned
    1 Post(s)
    Tagged
    1 Thread(s)
    Place this on the first line on the script page:
    #!/usr/local/bin/php5 -q

    Change the php number to what your server is using & set to.

  3. #3
    Follow Me On Twitter: @djg gold trophysilver trophybronze trophy Dan Grossman's Avatar
    Join Date
    Aug 2000
    Location
    Philadephia, PA
    Posts
    20,580
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)
    Lynx isn't generating the e-mail, crontab is.

  4. #4
    SitePoint Enthusiast Technographs's Avatar
    Join Date
    Jan 2009
    Posts
    47
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by spence_noodle View Post
    Place this on the first line on the script page:
    #!/usr/local/bin/php5 -q

    Change the php number to what your server is using & set to.
    I have used -q however still crontab genrates an E-mail. How to disable it ?

  5. #5
    Follow Me On Twitter: @djg gold trophysilver trophybronze trophy Dan Grossman's Avatar
    Join Date
    Aug 2000
    Location
    Philadephia, PA
    Posts
    20,580
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)

  6. #6
    SitePoint Addict
    Join Date
    Jun 2007
    Posts
    358
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I'm sorry I am not too bright.

    I don't know what is generating the email or not, my doubt was "is there was a way to stop it?" so placing #!/usr/local/bin/php5 -q in the first line of the script.php will discontinue the e-mailing? within <?php or outside of it?

    Dan, according to your link. doing lynx -dump http://domain.com/script.php>/dev/null 2>&1 will stop e-mail.

    So which is the best option yours or spence_noodle's suggestion?

    Thanks

  7. #7
    SitePoint Addict
    Join Date
    Jun 2007
    Posts
    358
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I tried lynx -dump http://domain.com/script.php >/dev/null 2>&1 is not working. Just a note though, I don't want to disable contab email alert entirely - just for lynx -dump http://domain.com/script.php.

    why is this so difficult without a direct and simple solution? google doesn't return much relevant results either.

  8. #8
    SitePoint Member
    Join Date
    Jun 2009
    Posts
    6
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    do you have cpanel (WHM) ? if so, click to cronjob and add this line into the advanced crontab

    /usr/local/bin/php -q /home/yourusername/public_html/yourphpfile.php

  9. #9
    SitePoint Addict
    Join Date
    Jun 2007
    Posts
    358
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by technolojik View Post
    do you have cpanel (WHM) ? if so, click to cronjob and add this line into the advanced crontab

    /usr/local/bin/php -q /home/yourusername/public_html/yourphpfile.php
    yes my shared hosting account has cpanel, that where i execute lynx -dump http://domain.com/script.php. so -q http://domain.com/script.php works the same as /usr/local/bin/php -q /home/yourusername/public_html/yourphpfile.php? I think I'll check it out tomorrow, its 1:14am here.

    note: my hosting account is a shared one and not vps or dedicated.

  10. #10
    SitePoint Wizard
    Join Date
    Mar 2008
    Posts
    1,149
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Try appending
    Code:
    2>&1 > /dev/null
    to the original command.


Bookmarks

Posting Permissions

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