How to run crontab-e?

I am currently reading this documentation here where I want to use CRON. Now the first section says that I need to enter the command: crontab -e .

I only need to enter this into a simple text editor and just upload the file to the server?

I use helios.hud.ac.uk, so this will 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('dm-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(); ?> 

URL for this php script: helios.hud.ac.uk/u00000000/Mobile/inactivatesession.php

I haven't used CRON before, so I just don't need help.

thanks

+4
source share
2 answers
  • You open a shell (possibly via SSH) on your server
  • You run the crontab -e command
  • You are editing crontab according to your needs (if you want to run php script via http, you need to use wget )
  • You save and complete. If you make no mistakes, you will receive a message stating that crontab has been updated.
+2
source

If you create a crontab that will access a remote web page (which is how it is not on your local server), you need to add the URL using wget

 * * 25 10 * wget -O - http://helios.hud.ac.uk/u00000000/Mobile/inactivatesession.php 

It will run the script on the server and print it to standard output (which will be emailed to you on most servers)

This assumes you have a Linux machine. crontab -e sets the cron tab for your user account. Thus, you cannot load crontab, but if you have cpanel or the like, most often you have access to cron from there.

+3
source

Source: https://habr.com/ru/post/1441941/


All Articles