Marius Miliunas
Marius Miliunas

Reputation: 1063

Possible for server to run scripts

So I realize this question is broad, as I'm looking for a place to start.

Is it possible to have a server that for example runs PHP scripts every day, or every 2 minutes?

Pretty much, I don't want to put these tasks in the users script, because I'm scared they would get run a lot more than is necessary, and I'd prefer to keep it separate.

I'm looking to keep it javascript, PHP or SQL as I don't have the time to learn a new language atm, so if any of you have any good places for me to read up on this, I would greatly appreciate it.

Upvotes: 0

Views: 138

Answers (3)

Blender
Blender

Reputation: 298206

Yes, it's completely possible. On Linux (Mac too?), you use the cron job scheduler to run your scripts.

For Windows, you can try the Windows Task Scheduler. It provides similar functionality.

You can run just about any script with cron, but not JavaScript (unless you use it for serverside stuff).

Upvotes: 0

rwyland
rwyland

Reputation: 1647

Javascript will not run server side as you are expecting. what I would suggest is you look into writing a cron job to run a bash file. It would take minimal research to complete.

Cron Intro

Bash Intro

Upvotes: 0

Dennis
Dennis

Reputation: 14477

There might be some way to run javascript on the server side, but I'd certainly stick to PHP. SQL is not a script, by the way...

You can execute your PHP scripts every x minutes / hours / days using cronjobs. Just google crontab. You need (root) access to the server though.

Upvotes: 1

Related Questions