ru en
Help
Print version

Task scheduler (cron) — scheduled launch of programs

Contents

  1. General information
  2. Management of scheduler tasks using control panel
  3. Examples of tasks setting

1. General information

Task schedule allows to execute commands on hosting server on a scheduled basis.

Scheduler management is made in section "Web server" — "Task scheduler" of the hosting control panel (https://www.r01.ru, "Account manager" section).

Specifics of hosting task scheduler:

  • minimum interval between tasks — 5 minutes;
  • hosting has a preset logrotate task by default, which launches daily archiving of web server log-files and counting of website visit statistics.

2. Management of scheduler tasks using control panel

To create a new task:

2.1. Log in to hosting control panel (https://www.r01.ru, section "Account manager"), using your agreement number and password.

2.2. Go to "Web server" — "Task scheduler" section.

2.3. In "New task" block enter name of a new task, for example task1, and click on "Create".

2.4. Click on the name of the new task to go to the page with the task settings.

2.5. Set the time of task running, for example, every day at 00:00.

2.6. In field "Executable program" enter the command (see item 3) and save changes.

2.7. New task will be launched not earlier than in 10 minutes.

If value "Yes" is set for "Display messages" setting, script operation result (which is turned to the appropriate output (stdout) and error (stderr) streams) will be sent to address postmaster@identifier.r01host.ru. Copy of letter will be sent to addresses specified as contact emails under the agreement.

3. Examples of tasks setting

Run of php scripts

To launch php script the following command may be used:

cd $HOME/папка_сайта/docs/папка_скрипта/ && /opt/php/bin/php -c $HOME/etc/php.ini $HOME/папка_сайта/docs/папка_скрипта/имя_скрипта.php

Here:

  • cd $HOME/website_folder/docs/script_folder/ — move to directory, where the script is placed;
  • /opt/php/bin/php -c $HOME/etc/php.ini — path to php interpreter and php.ini configuration file;
  • $HOME/website_folder/docs/script_folder/script_name.php — full path to the script.

Run of php scripts with settings

/usr/local/bin/wget -O - -q "http://r01.ru/cron.php?var1=xxx&var2=yyy"

Here:

  • /usr/local/bin/wget — path to program wget,
  • http://r01.ru/cron.php?var1=xxx&var2=yyy — script address with the settings.

Run of shell scripts

To launch shell script it would be enough to specify full path to the script as a command:

/home/identifier/scripts/test.sh

Script file shall have an execution attribute.

Copyright © 2000-2024 Registrar R01
Information: info@r01.ru
Support: support@r01.ru
Office: 1 Bolshoy Gnezdnikovsky Lane, building 2, Moscow (Tverskaya metro station, entrance No. 9, Voznesensky business center)