473,796 Members | 2,648 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

How to schedule script without cron?

Is there a way to get my script to run on regularly scheduled intervals
without using cron? My hosting provider sucks... cannot use cron... I was
thinking perhaps I could create a file every hour in a certain directory and
then fire the script when the file count reaches a certain number, and then
clear out the directory... or something like that. Any suggestions?

Thanks in advance.
Jul 17 '05
29 11283
"deko" <no****@hotmail .com> wrote in news:uZaJc.1031 6$8Y.3454
@newssvr25.news .prodigy.com:
on your most visited webpage, use some server side code that checks the
time and if it falls withing your interval range, then run some code.


this is what the log looks like:

Jul 13 2004 06:30 pm|68.110.65.24 1|Windows 95|MSIE 5|pacbell.net
Jul 13 2004 06:32 pm|68.127.69.10 1|Windows 95|MSIE 5|pacbell.net
Jul 13 2004 06:34 pm|203.12.69.23 1|Windows 95|MSIE 5|pacbell.net
Jul 13 2004 06:36 pm|64.122.69.14 1|Windows 95|MSIE 5|pacbell.net
Jul 13 2004 06:38 pm|68.110.69.26 |Windows 95|MSIE 5|pacbell.net

so if I can somehow analyze the date column...

if the bottom visit is less than [time() - 3600 * 24] then
move to the next line
else
run script

does this sound about right?


Doesn't your host provide analog, webalizer, awstats, or any of the other
free log analysys programs?

If not, does your hosting provide php and mysql?

Just log every visit to a mysql database and whenever you want to know
anything about your traffic pattern, query the database.

Select count(date) from visitors where date = dateyouwhattokn ow;

You can create whatever sql statement you want. This is the way I would do
it.

--
Edward Alfert
http://www.rootmode.com/
Multiple Domain Hosting and Reseller Hosting Plans
Coupon Code (Recurring $5/month Discount): newsgroup

Jul 17 '05 #11
> create a "master" process, execute it in the background
$ ./timer &

that is in a loop:

loop
if nextinterval do something
wait until nextintervaltim e
goto loop

unless you are able to have access to the system level, you are out of luck. Any process not assoiciated with the server itself, would probably be detecteced and killed. Do yourself a favor, spend a few extra bucks, get DSL or Cable at a level that will allow you to run your own server (and use a hardware firewall). This can be done using DynamicDNS (static IP not necessary). You will not be able to use outbound SMTP because your IP address does not backtranslate, but that is no big deal. I use DDNS for inbound POP SMTP and my ISP for outbound. If your ISP has a history of lots of downtime during the day, then you may need to look for something more stable.

If they reboot the system for maintenance or whatever, you will have to restart your script. Use a box that you have control over... Trying to use ISP
"freebies" is really bad idea. Bottom line: if it is that important, get your own system to work with... BTW, I have 2 Linux boxes and one OpenVMS box on the net using DDNS (zoneedit.com). .. All can do {L|V}AMP, but they also do a

lot more :)

I was looking at DDNS a few weeks ago, but decided to go with a hosting
provider for portability purposes - that is, if I move, or change hosting
providers, my site is still up and email keeps coming. So uptime was
important, and also speed...

I do not have access to the server at my hosting provider, so, as you say,
I'm out of luck in terms of using a process-based schedule.
Jul 17 '05 #12
> user@host:~> nohup bash -c '
while true ; do
echo run your prog here
sleep 3600
done'


that is a good suggestion, but I think a file-based solution might be more
reliable - for example, what if the server gets rebooted or something.
Jul 17 '05 #13
> Right, Lets say your hosted site (domain.com) has a phpscript in /php/
called dorun.php that needs to be run every hour, every day add the
following line to your crontab

5 * * * 0-6 lynx http://www.domain.com/php/dorun.php


That sound like it would work, but then, potentially, anyone could kick off
my script. Is this correct? Also, forgive my ignorance, but what is lynx?
Jul 17 '05 #14
> On every page load write the current date (not time) to a text file and
compare it to the previous line. If the date has changed, then count the
number of lines in the file (minus 1) and that is the number of hits the
previous day. Write this number to a different file including yesterday's
date and count.


I have the counter script already written - but I want to update the figures
every three hours and maintain a rolling count. So, every three hours the
figures for each interval (24h, 30d, 365d) are updated. This would be easy
to do with cron, but alas, cron cannot be used...
Jul 17 '05 #15
> Doesn't your host provide analog, webalizer, awstats, or any of the other
free log analysys programs?
Yes, but this has a special purpose
If not, does your hosting provide php and mysql?


Yes, but I need a file-based solution

Jul 17 '05 #16
> > Jul 13 2004 06:30 pm|68.110.65.24 1|Windows 95|MSIE 5|pacbell.net
Jul 13 2004 06:32 pm|68.127.69.10 1|Windows 95|MSIE 5|pacbell.net
Jul 13 2004 06:34 pm|203.12.69.23 1|Windows 95|MSIE 5|pacbell.net
Jul 13 2004 06:36 pm|64.122.69.14 1|Windows 95|MSIE 5|pacbell.net
Jul 13 2004 06:38 pm|68.110.69.26 |Windows 95|MSIE 5|pacbell.net

so if I can somehow analyze the date column...

if the bottom visit is less than [time() - 3600 * 24] then
move to the next line
else
run script

does this sound about right?


Is there a way to get file modification time in php? Perhaps I could just
check the mod date of a file with each visit.

For example, each time the site is visited, write something to a file.
Then, a separate script checks that file's mod date. If the mod date is 3
hours old, then run the script. Do you think this would work?
Jul 17 '05 #17

"deko" <no****@hotmail .com> wrote in message
news:E6******** *********@newss vr25.news.prodi gy.com...
Right, Lets say your hosted site (domain.com) has a phpscript in /php/
called dorun.php that needs to be run every hour, every day add the
following line to your crontab

5 * * * 0-6 lynx http://www.domain.com/php/dorun.php
That sound like it would work, but then, potentially, anyone could kick

off my script. Is this correct? Also, forgive my ignorance, but what is lynx?


lynx is a text based browser that ships with most linux distros.

You could always put a clause in the script to only allow you to run it (For
example must have a certain password, or http authentication. ) but otherwise
anyone could run it yes.
Jul 17 '05 #18
"deko" <no****@hotmail .com> wrote in
news:Ki******** ********@newssv r25.news.prodig y.com:
> Jul 13 2004 06:30 pm|68.110.65.24 1|Windows 95|MSIE 5|pacbell.net
> Jul 13 2004 06:32 pm|68.127.69.10 1|Windows 95|MSIE 5|pacbell.net
> Jul 13 2004 06:34 pm|203.12.69.23 1|Windows 95|MSIE 5|pacbell.net
> Jul 13 2004 06:36 pm|64.122.69.14 1|Windows 95|MSIE 5|pacbell.net
> Jul 13 2004 06:38 pm|68.110.69.26 |Windows 95|MSIE 5|pacbell.net
>
> so if I can somehow analyze the date column...
>
> if the bottom visit is less than [time() - 3600 * 24] then
> move to the next line
> else
> run script
>
> does this sound about right?


Is there a way to get file modification time in php? Perhaps I could
just check the mod date of a file with each visit.

For example, each time the site is visited, write something to a file.
Then, a separate script checks that file's mod date. If the mod date
is 3 hours old, then run the script. Do you think this would work?


yes... take a look at user comments at
http://www.php.net/manual/en/function.fileatime.php
--
Edward Alfert
http://www.rootmode.com/
Multiple Domain Hosting and Reseller Hosting Plans
Coupon Code (Recurring $5/month Discount): newsgroup

Jul 17 '05 #19
> You could always put a clause in the script to only allow you to run it
(For
example must have a certain password, or http authentication. ) but otherwise anyone could run it yes.


Perhaps I could check the modification date of a file with php and base my
scheduling on that. I could use lynx simply to visit the site at 12:00 each
day, which would create a benchmark file. Then my script checks the mod
date of that file... woudl this work? How to check the mod date of a file
with php?

I would like to know more abotu using lynx and authentication - for example,
can I automate a login to my bank's online banking page to get my bank
balance each day? Of course, that site uses encription and probally a bunch
of other security I don't understand...

Jul 17 '05 #20

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
9456
by: Timo-Pekka Oikarinen | last post by:
Is there PHP chat script *without* MySQL? Demands: absolutely FREE (no adware, shareware etc.), No MySQL needed, one permanent public chat, can make your own channels (public/private) like IRC, several admins (one superadmin, me ;-D ), bad word filter, user nick ban/ip ban/kick (temporary/permanent), small file sharing and @time script ( http://www.swatch.com/internettime/home.php ) to upper right corner. Environment: Windows 2000 Pro...
5
9206
by: deko | last post by:
In regard to running php scripts with cron - Here is a sample script: <?php //debug.php echo "<br> This is a test"; ?> I can call debug.php from a web page on my site like this:
2
2486
by: erikcw | last post by:
Hi all, When trying to run this python script from cron, I get the following error: Traceback (most recent call last): File "/home/lybp/public_html/wa/wa.py", line 14, in ? import MySQLdb ImportError: No module named MySQLdb
1
3284
by: vaskarbasak | last post by:
Hi All, how will i set shell script on cron tab to execute the script? please help me. Thanks! Vaskar
2
3252
by: smitanaik | last post by:
i have a java file which i am running through shell script. the syntax that i have used is #! /bin/bash javac Copy.java
1
1594
by: djpaul | last post by:
Hello, I am just a newbie to javascript, but the most stuff i do is in php or .net. But, now i have 2 buttons on my script that are calling a javascript function as shown below (OnClick""). Now after a person pushes 1 of the 2 buttons, i want to send some information to a php-file to update my database. The only thing that the customer will see is a message from the alert( "Thanks"); for example. This is what i did now: <script...
0
10236
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...
1
10182
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
10017
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
9055
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
7552
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
6793
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
5577
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4120
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
3
2928
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.