Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 263547
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 11, 20262026-05-11T22:36:39+00:00 2026-05-11T22:36:39+00:00

I have this mail script I have to run a few times. To start

  • 0

I have this mail script I have to run a few times.
To start the script I will use cron, but the script has to run 2 or 3 more times (with an hour apart).

What’s the best way to do this?
To use the sleep command for an hour, or at the end of the script, place some code, so that the script will create a new cron job to run it self after an hour?

Thanks

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-11T22:36:39+00:00Added an answer on May 11, 2026 at 10:36 pm

    Unless there’s some cost savings in keeping the script running in memory, you’re better off using cron to invoke it every hour, as needed.

    0 0-2 * * * /usr/local/bin/mail-script.php
    

    You can choose multiple hours using the – syntax, or the comma syntax:

    0 0,1,2,3 * * * /usr/local/bin/mail-script.php
    

    If it needs to maintain some form of state, use a temporary file to keep saved state.

    Do:

    > man 5 crontab
    

    To see if your *nix handles the above cases.

    Finally, unless you know the script has to run only 2-3 times, you’re better off putting the logic about whether to “run or not to run” in the PHP script itself, and then just run it every hour.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

We currently have a working php mail script, this works fine and as we
I have a requirement to run a server script on scheduled times entered by
I have a simple E-mail done. I want this email form to run during
I have this script: require_once Mail.php; $from = Stephen <username@nvrforget.com>;//Google apps domain $to =
I have this script which i use on my own website: <?php error_reporting(E_ALL); $email_subject
I have recently discovered that I am affected by this bug http://www.mail-archive.com/mono-bugs@lists.ximian.com/msg71515.html Well, at
This is what i have: Main.mxml: <fx:Style source=Main.css/> <s:TextInput x=72 y=95 focusColor=#CECB02 prompt=E-mail: skinClass=components.TextInputSkin/>
why do I get this exception?please suggest any solutions.i have properly copied mail.jar and
Have this query: SELECT HOUR( DATE ) AS hr, COUNT( * ) AS cnt
I have a typical mail.php script, which uses the mail() function. After the user

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.