Reputation: 1207
I am currently reading this documentation here where I want to use CRON. Now it says in the first section that I need to enter in a command: crontab -e
.
Do I only need to enter this in a simple text editor file and just upload the file into the server?
I am using helios.hud.ac.uk so would this be the correct command:
* * 25 10 * helios.hud.ac.uk/u00000000/Mobile/inactivatesession.php
This will execute this php script below (inactivatesession.php):
<?php
include('connect.php');
$createDate = mktime(0,0,0,10,25,date("Y"));
$selectedDate = date('d-m-Y', ($createDate));
$sql = "UPDATE Session SET Active = ? WHERE DATE_FORMAT(SessionDate,'%Y-%m-%d' ) <= ?";
$update = $mysqli->prepare($sql);
$update->bind_param("is", 0, $selectedDate);
$update->execute();
?>
The url for this php script is: helios.hud.ac.uk/u00000000/Mobile/inactivatesession.php
I havn't used CRON before so just need little help on it.
Thanks
Upvotes: 4
Views: 153
Reputation: 40695
crontab -e
wget
) Upvotes: 2
Reputation: 4736
If you are making a crontab that will access a remote webpage (which is what this is as it is not on your local server) you need to prepend the URL with wget
* * 25 10 * wget -O - http://helios.hud.ac.uk/u00000000/Mobile/inactivatesession.php
It will run the script on the server and output it to standard output (which in most servers will be emailed to you)
This assumes that you have a linux machine. crontab -e
sets up a cron tab for your user account. So you can't really upload a crontab, but if you have cpanel or similar, most times you have access to cron from there.
Upvotes: 3