/    Sign up×
Community /Pin to ProfileBookmark

How would I specify to get something every third hour using this? getHours()

Hello, just wondering how to specify something only being changed on every third hour, using this… “getHours()”

Please let me know, thanks a lot.

to post a comment
JavaScript

6 Comments(s)

Copy linkTweet thisAlerts:
@CrazyMerlinOct 20.2006 — what you need cannot be done in javascript as it requires you to store a value of the last script execution when the script is not running.

to do this you need a system command to run. Talk to you ISP, netword manager, about setting up a cron job.

you can then have it run a script every 3 hours to make your necessary changes.

//erlin!
Copy linkTweet thisAlerts:
@RiannaauthorOct 20.2006 — Thanks, I would love it if you could explain just a bit what a cron job is. Appreciated.
Copy linkTweet thisAlerts:
@CrazyMerlinOct 20.2006 — np, cron (chronological) is a unix system command that executes scripts every x minutes.

so you just tell it what script to execute and when and it takes care of everything.

usually it is used for running cgi scripts, but you can get it to run a php script also, which basically means you can do anything.

if you have access to the server control panel where your files are, and the software running is CPanel, you will have a link to Cron Jobs.

if not, just ask your ISP/net tech guy how to set one up. If none of those are an option let me know how/where your files are and I'm sure we can figure something out.

if you are on a windows server there are also versions for that like CRONw or WinCron.

//erlin!
Copy linkTweet thisAlerts:
@RiannaauthorOct 20.2006 — Thanks a lot, one more thing please and I can probably try to figure the rest from here.

I have a control panel and my account is a linux account. What is it I look for in the

control panel that may help me with this? Thank you very much.
Copy linkTweet thisAlerts:
@CrazyMerlinOct 20.2006 — if it is on your CP it will definately be called Cron or Cron Jobs.

you will find a host of information on the net about how to set them up for each server control panel.

//erlin!
Copy linkTweet thisAlerts:
@RiannaauthorOct 20.2006 — Thank you very much Merlin!!
×

Success!

Help @Rianna spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 6.16,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @nearjob,
tipped: article
amount: 1000 SATS,

tipper: @meenaratha,
tipped: article
amount: 1000 SATS,

tipper: @meenaratha,
tipped: article
amount: 1000 SATS,
)...