Automated Server Scripts at Intervals

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • enko

    Automated Server Scripts at Intervals

    Our company has developed a web-app that needs the ability to run a
    regular maintenance PHP script and use it also send out SMS/Email
    alerts on a regular basis, say at exactly 9AM and 2PM without user
    interaction. We're using shared hosting at the moment, so we have no
    access anything more than our file directory on the server and our
    database. To resolve this I've created a small vb.net app that accesses
    the maintenance script on our server at the preset times, which sends
    out the email and everything as it should. This is functional for now
    but I see this as a short-term solution considering the possible
    unreliability of running an app outside of the server on a home/office
    computer, also the possible security risks involved. I was wondering if
    anyone knew of a better solution. We're going to be upgrading to a
    dedicated server within a few months and surely there is a way for the
    server to automatically run a php script at regular intervals? Maybe
    I'm just looking for the most difficult solution, but any help would be
    appreciated.

  • NC

    #2
    Re: Automated Server Scripts at Intervals

    enko wrote:[color=blue]
    >
    > Our company has developed a web-app that needs the ability to run a
    > regular maintenance PHP script and use it also send out SMS/Email
    > alerts on a regular basis, say at exactly 9AM and 2PM without user
    > interaction. We're using shared hosting at the moment, so we have no
    > access anything more than our file directory on the server and our
    > database. To resolve this I've created a small vb.net app that accesses
    > the maintenance script on our server at the preset times, which sends
    > out the email and everything as it should. This is functional for now
    > but I see this as a short-term solution considering the possible
    > unreliability of running an app outside of the server on a home/office
    > computer, also the possible security risks involved. I was wondering if
    > anyone knew of a better solution. We're going to be upgrading to a
    > dedicated server within a few months and surely there is a way for the
    > server to automatically run a php script at regular intervals?[/color]

    Since you are upgrading to a dedicated server, I think the problem is
    not worth solving now. Just make sure you take appropriate precautions
    against accidentally running the maintenance script too often (have the
    script keep a log of its activity and do nothing unless it's time for
    the next run).

    Also, when you do upgrade, it's probably a good idea to run your script
    from the command line...

    Cheers,
    NC

    Comment

    • Jonathan Wiltshire

      #3
      Re: Automated Server Scripts at Intervals


      "enko" <mbyrd1332@gmai l.com> wrote in message
      news:1141409357 .429781.247610@ e56g2000cwe.goo glegroups.com.. .[color=blue]
      > We're going to be upgrading to a
      > dedicated server within a few months and surely there is a way for the
      > server to automatically run a php script at regular intervals? Maybe
      > I'm just looking for the most difficult solution, but any help would be
      > appreciated.[/color]

      Once you've got your dedicated server, the daemon you want it called crond
      if it's
      Linux, or the Task Scheduler if it's Windows. Either way, you need to call
      'php myscript.php'.
      However, make sure your script doesn't expect to use Apache/IIS-specific
      stuff, or
      PHP will bail out.

      If you speak very nicely with your hosts, they might set this up for you
      temporarily now,
      on the grounds that you're going to upgrade to a dedicated server soon
      anyway.

      Jon


      Comment

      • d

        #4
        Re: Automated Server Scripts at Intervals

        "Jonathan Wiltshire" <news@jwiltshir e.org.uk> wrote in message
        news:AS1Of.7029 1$m13.60862@new sfe5-gui.ntli.net...[color=blue]
        >
        > "enko" <mbyrd1332@gmai l.com> wrote in message
        > news:1141409357 .429781.247610@ e56g2000cwe.goo glegroups.com.. .[color=green]
        >> We're going to be upgrading to a
        >> dedicated server within a few months and surely there is a way for the
        >> server to automatically run a php script at regular intervals? Maybe
        >> I'm just looking for the most difficult solution, but any help would be
        >> appreciated.[/color]
        >
        > Once you've got your dedicated server, the daemon you want it called crond
        > if it's
        > Linux, or the Task Scheduler if it's Windows. Either way, you need to call
        > 'php myscript.php'.
        > However, make sure your script doesn't expect to use Apache/IIS-specific
        > stuff, or
        > PHP will bail out.
        >
        > If you speak very nicely with your hosts, they might set this up for you
        > temporarily now,
        > on the grounds that you're going to upgrade to a dedicated server soon
        > anyway.[/color]

        Provided the new server is with them :-P
        [color=blue]
        > Jon
        >[/color]


        Comment

        • Jonathan Wiltshire

          #5
          Re: Automated Server Scripts at Intervals


          "d" <d@example.co m> wrote in message
          news:Dl2Of.2970 3$wl.15950@text .news.blueyonde r.co.uk...[color=blue]
          >
          > Provided the new server is with them :-P
          >[/color]

          Well, yeh, there is that.. ;-)


          Comment

          • Andy Jeffries

            #6
            Re: Automated Server Scripts at Intervals

            On Fri, 03 Mar 2006 21:15:15 +0000, d wrote:[color=blue][color=green][color=darkred]
            >>> We're going to be upgrading to a
            >>> dedicated server within a few months and surely there is a way for the
            >>> server to automatically run a php script at regular intervals? Maybe
            >>> I'm just looking for the most difficult solution, but any help would be
            >>> appreciated.[/color]
            >>
            >> Once you've got your dedicated server, the daemon you want it called
            >> crond if it's
            >> Linux, or the Task Scheduler if it's Windows. Either way, you need to
            >> call 'php myscript.php'.
            >> However, make sure your script doesn't expect to use Apache/IIS-specific
            >> stuff, or
            >> PHP will bail out.
            >>
            >> If you speak very nicely with your hosts, they might set this up for you
            >> temporarily now,
            >> on the grounds that you're going to upgrade to a dedicated server soon
            >> anyway.[/color]
            >
            > Provided the new server is with them :-P[/color]

            But most hosts would do it now on the fact the client says "we're going to
            be going dedicated in 3 months and will be considering your company for
            that, in the meantime would you....."

            It may help if you get a sexy-sounding lady to call for you :-)

            Cheers,


            Andy


            --
            Andy Jeffries | gPHPEdit Lead Developer
            http://www.gphpedit.org | PHP editor for Gnome 2
            http://www.andyjeffries.co.uk | Personal site and photos

            Comment

            • Jonathan Wiltshire

              #7
              Re: Automated Server Scripts at Intervals


              "Andy Jeffries" <news@andyjeffr ies.co.uk> wrote in message
              news:pan.2006.0 3.05.10.43.37.4 55006@andyjeffr ies.co.uk...[color=blue]
              >
              > But most hosts would do it now on the fact the client says "we're going to
              > be going dedicated in 3 months and will be considering your company for
              > that, in the meantime would you....."
              >
              > It may help if you get a sexy-sounding lady to call for you :-)
              >[/color]

              Exactly. They'll probably be a lot more helpful if they think you'll go
              dedicated with them.

              J


              Comment

              • google@impliedbydesign.com

                #8
                Re: Automated Server Scripts at Intervals


                enko wrote:[color=blue]
                > We're going to be upgrading to a
                > dedicated server within a few months and surely there is a way for the
                > server to automatically run a php script at regular intervals? Maybe
                > I'm just looking for the most difficult solution, but any help would be
                > appreciated.[/color]

                Hello,

                I've only had to deal with doing this on a shared hosting, so the
                solution might be different than on your dedicated host, but you can
                set up something called a cron job, which will run a script at a
                particular time, or interval. I use a simple interface, through my
                host's control panel, but you can also program cron jobs through the
                command line.

                Chris S.

                Free Web Design Tools


                Comment

                Working...