473,657 Members | 2,805 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Cron Job

51 New Member
I have a question :
I m using window host and i dont have either cronjob function and schedule task (i asked host provider ,they said they donnot have it)
So have any scripts(php,jav ascript....) to do this work(running a file on server with specific time)?
Thanks so much.
Mar 31 '08 #1
8 1307
TheServant
1,168 Recognized Expert Top Contributor
In a word no. You see, php, javascript, html etc are all only "run" when they are called. So when a user goes there is one of two ways it can be called. The second way is if a server automatically runs it. This is usually done with cronjobs and is really what you need.

May I ask which provider you're with?

What does the file do that you want to run in a cronjob? Maybe there is a way around it?
Mar 31 '08 #2
th1982
51 New Member
Thanks TS!!! they are my local provider,i m sure you dont know them.
I want to run a script to import data from xml file to mysql.it will be run everyday at specific time.
are any solutions for it?
Thanks
Mar 31 '08 #3
dlite922
1,584 Recognized Expert Top Contributor
Thanks TS!!! they are my local provider,i m sure you dont know them.
I want to run a script to import data from xml file to mysql.it will be run everyday at specific time.
are any solutions for it?
Thanks
yes there is.

from a computer that has internet access around the time you want to run it, and do a scheduled task/cron job that calls a PHP file that does exactly that.

Good luck.
Mar 31 '08 #4
TheServant
1,168 Recognized Expert Top Contributor
I think that's what we're talking about? But yeah, if your provider doesn't offer it, you will need to schedule it on your own computer and so it has to be on. If it is only once a day, this isn't too big a task. A lot of mine (will) run every 10mins, so it's really impossible for me to use that option.

Actually, I have thought of another way. It's a little fiddley, but it should work. What you is you have a small bit of code at login (or a common page) that checks the time against when the last time your file was run. So you need to have another MySQL table which just stores the last time it was run.

When the user (anyone) goes to your site and logs in, a bit of code will run and check if the current time is over 24 hours from the last run time. If it is, it will execute that file and do what you want. If not, it will continue as normal.

I know it's probably been done before, but I've never heard of it, so for the next 5mins we will pretend that I am a genius ;)
Mar 31 '08 #5
Markus
6,050 Recognized Expert Expert
I think that's what we're talking about? But yeah, if your provider doesn't offer it, you will need to schedule it on your own computer and so it has to be on. If it is only once a day, this isn't too big a task. A lot of mine (will) run every 10mins, so it's really impossible for me to use that option.

Actually, I have thought of another way. It's a little fiddley, but it should work. What you is you have a small bit of code at login (or a common page) that checks the time against when the last time your file was run. So you need to have another MySQL table which just stores the last time it was run.

When the user (anyone) goes to your site and logs in, a bit of code will run and check if the current time is over 24 hours from the last run time. If it is, it will execute that file and do what you want. If not, it will continue as normal.

I know it's probably been done before, but I've never heard of it, so for the next 5mins we will pretend that I am a genius ;)
What if noone visits the page for months?

OR EVEN YEARS?!

I don't believe it's too hard to, on your own pc, use windows schedule task manager.

Regards.
Mar 31 '08 #6
th1982
51 New Member
Thanks so much!!!
but when i use schedule task ,i can only see the applications on my computer.How can i set to run a php file on server ?sorry,i m first time using this task .
Thanks
best regards
Apr 1 '08 #7
oberon
14 New Member
Hi!
In your schedule you'll need to specify an application or a script that does the task of calling your remote script url.
You could for example call a web browser with the url as argument. A more elegant alternative would be to write a VB script to call the url. An example VB script can be as follows:
Expand|Select|Wrap|Line Numbers
  1. 'scriptfile.vbs
  2. Call LogEntry()
  3. Sub LogEntry()
  4.         On Error Resume Next
  5.         Dim objRequest
  6.         Dim URL
  7.         Set objRequest = CreateObject("Microsoft.XMLHTTP")
  8.         URL = "http://YOUR-URL"
  9.         objRequest.open "POST", URL , false
  10.         objRequest.Send
  11.         Set objRequest = Nothing
  12. End Sub
Hope this could be of help.
Apr 1 '08 #8
Markus
6,050 Recognized Expert Expert
Thanks so much!!!
but when i use schedule task ,i can only see the applications on my computer.How can i set to run a php file on server ?sorry,i m first time using this task .
Thanks
best regards
Just open your task scheduler, then select your internet browser as the action (giving the url of your script as an extra argument).

Regards.
Apr 1 '08 #9

Sign in to post your reply or Sign up for a free account.

Similar topics

6
2668
by: sherryonline | last post by:
i have a page and i need that page to be called every day at 12:00 that page is going to connect to the database fetch some emails and will start mailing them how i am goning to do this.
4
3047
by: vagrantbrad | last post by:
I'm using python 2.4 running on Fedora Core 4. I have written a python program called ipscan.py that checks the external ip address of my cable internet connection, and on change, will update the dns records at my dns provider, zoneedit. So basically, I've setup dynamic dns using python. Once the ip compare and/or update is complete, I log the results to a text file called update.log. When I run the program in a bash shell with the...
3
10303
by: the.natalie | last post by:
Hi. I am a newbie to mysql, cron, and shell scripting, so please bear with me. I have a script that is used for updating an image directory based on contents in a database. The script does the following: runs several queries against different tables in a database; returns several lists of pictures being used in the database; removes any obsolete images from specific directories. The script is bash shell script. The problem is that...
0
3467
by: Cameron Simpson | last post by:
On 17Aug2008 21:25, John Nagle <nagle@animats.comwrote: Because $HOSTNAME is a bash specific variable, set by bash but NOT EXPORTED! Like $0 and a bunch of other "private" variables, subprocesses do not inherit this value. From "man bash": Shell Variables The following variables are set by the shell:
1
2303
by: Karthik Gurusamy | last post by:
Hi, I'm working on a cron like functionality for my application. The outer loops runs continuously waking every x seconds (say x=180, 300, ..). It needs to know what events in cron has expired and for each event do the work needed. It's basically like unix cron or like a calendar application with some restrictions. The outer loop may come back a lot later and many events
0
8833
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
8737
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
8610
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
7345
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6174
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5636
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4168
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4327
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2735
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.