Skip to content

Cron

Cron can perform tasks regularly, such as: backup website, backup database, backup directory, execute commands, automatic task execution, etc.

Cron Overview

alt text

Cron Job

  • Add Task : Add scheduled task

  • All categories : View the specified task category

  • Name : task name

  • Status : The status of the task, whether Stopped or Running

  • Execute cycle : Execution cycle time

  • Number of Save : Set the number of backup files to keep. If they exceed the number, they will be automatically deleted.

  • Backup to : Back up to specified storage location, supportedLocal Disk,FTP Storage,Google Drive,Google Cloud Storage,AWS S3. In addition to Local Disk, other storage locations need to be installed and configured in the APP Store.

  • Last execute time : Last execution time of this task

  • Execute : Click to perform this task now

  • Edit : Edit scheduled tasks

  • Log : View the execution log in this task, can check the task execution results

  • Delete : Delete scheduled tasks

Add Task or Edit -- Cron Job

  1. Shell Script

    Execute specified commands regularly

    alt text

    • Task type : chooseShell Script

    • Task name : Enter the name of the task

    • Execute cycle : time support Daily,N Days,Hourly,N Hours,N Minutes,Weekly``Monthly,N Second.

    • Execute user : User who performs the task

    • Script content : Enter the command to be executed

  2. Backup Site

    Back up website regularly

    alt text

    • Task type : chooseBackup Site

    • Task name : Display the backup task name

    • Execute cycle : time support Daily, N Days, Hourly, N Hours, N Minutes, Weekly Monthly.

    • Backup reminder : Reminder when backup fails, support Email,Dingding,WeCom,Feishu,Telegram

    • Backup site : Select all or specified websites

    • Backup to : Select the location where the backup files are to be stored, supportedLocal Disk,FTP Storage,Google Drive,Google Cloud Storage,AWS S3.

    • Backup setting : The backup save location is:FTP Storage,Google Drive,Google Cloud Storage,AWS S3, Can choose to keep the backup file locally on the server.

    • Retain the latest : Keep the latest copies, old ones will be deleted

    • Exclusion rules : Exclude files or directories that are not backed up.

  3. Backup Database

    Schedule backup of database, currently only supports MySQL database

    alt text

    • Task type : chooseBackup Database

    • Task name : Display the backup task name

    • Execute cycle : time support Daily, N Days, Hourly, N Hours, N Minutes, Weekly Monthly.

    • Backup reminder : Reminder when backup fails, support Email, Dingding, WeCom, Feishu, Telegram

    • Backup database : Select the supported database type, currently only supportedMySQLdatabase

    • Database : Select all or specified databases

    • Backup to : Select the location where the backup files are to be stored, supportedLocal Disk,FTP Storage,Google Drive,Google Cloud Storage,AWS S3.

    • Retain the latest : Keep the latest copies, old ones will be deleted

    • Backup setting : The backup save location is:FTP Storage,Google Drive,Google Cloud Storage,AWS S3, Can choose to keep the backup file locally on the server.

  4. Cut Log

    Regularly cut website logs

    alt text

    • Task type : chooseCut Log

    • Task name : Display the cutting task name

    • Execute cycle : time support Daily, N Days, Hourly, N Hours, N Minutes, Weekly Monthly.

    • Cutting Log : Select all or specified websites

    • Part : How many days old logs should be retained, the default is 180 days

  5. Backup Directory

    Schedule backup directory

    alt text

    • Task type : chooseBackup Directory

    • Task name : Display the backup task name

    • Execute cycle : time support Daily, N Days, Hourly, N Hours, N Minutes, Weekly Monthly

    • Backup reminder : Reminder when backup fails, support Email, Dingding, WeCom, Feishu, Telegram

    • Backup path : Select directory to backup

    • Backup to : Select the location where the backup files are to be stored, supportedLocal Disk,FTP Storage,Google Drive,Google Cloud Storage,AWS S3.

    • Retain the latest : Keep the latest copies, old ones will be deleted

    • Backup setting : The backup save location is:FTP Storage,Google Drive,Google Cloud Storage,AWS S3, Can choose to keep the backup file locally on the server.

    • Exclusion rules : Exclude files or directories that are not backed up.

  6. Sync Time

    Synchronize server time

    alt text

    • Task type : chooseSync Time

    • Task name : Display task name

    • Execute cycle : time support Daily, N Days, Hourly, N Hours, N Minutes, Weekly Monthly

    • Region selection : Select the region to be synchronized

  7. Free RAM

    Restart PHP, MYSQL, PURE-FTPD, APACHE, NGINX services regularly to release memory

    alt text

    • Task type : chooseFree RAM

    • Task name : Display task name

    • Execute cycle : time support Daily, N Days, Hourly, N Hours, N Minutes, Weekly Monthly

  8. Access URL

    Visit website links regularly

    alt text

    • Task type : chooseAccess URL

    • Task name : Display task name

    • Execute cycle : time support Daily, N Days, Hourly, N Hours, N Minutes, Weekly Monthly, N Second.

    • URL address : Fill in the website link want to visit

    • User-Agent : Fill in User-Agent, can be empty

Log -- Cron Job

Check the scheduled task execution log and view the execution results based on the log.

alt text

  • Refresh log : Get the latest log, or refresh automatically

  • Empty log : Clear logs

  • Execute : Execute task immediately

Task Scheduling

Automatically execute the next task based on the results returned by the task

alt text

  • Add Task : Add a Task Scheduling

  • Name : task name

  • Execute cycle : time support Daily, N Days, Hourly, N Hours, N Minutes, Weekly Monthly

  • Remark : Task notes

  • Creation time :Task creation time

  • Last execute time : Task last execution time

  • Execute : Execute this task now

  • Event : Trigger event, match the task execution result to trigger the next task

  • Edit : Edit task

  • Log : View task logs and check task execution results

  • Delete : delete task

Add Task / Edit -- Task Scheduling

alt text

  • Task name : Enter task name
  • Execute cycle : time support Daily, N Days, Hourly, N Hours, N Minutes, Weekly Monthly
  • Execute : Select the script library or enter the command content
  • Remark : Task notes

Event

Matching based on task results triggers the next task

alt text

When the result is equal toIncludewhen, executeStart Nginxscript

  • Create Trigger Event

    1. Execution results: When the results of the task match the input content, the script selected by Execute is automatically executed. Matching options: Include or Exclude or Equal or Unequal
    2. Execute: When the conditions of *Execution results are met, select the script to be executed. You can add the script in Script library
    3. The above picture explains: When the result is equal toIncludewhen, executeStart Nginxscript
    • Edit : Edit trigger event

    • Log : View the trigger event log and check the trigger execution results

    • Delete : Delete trigger event

Task Scheduling example:

Requirement: Check whether the Nginx status is stopped every 5 minutes. If it stops, automatically trigger the start of Nginx.

  1. Add a Task Scheduling

    • Task name : Check nginx status

    • Execute cycle : 5 minutes

    • Execute : Select the script library and selectGet Nginx Status, finally confirm adding

    As shown in the picture:

    alt text

  2. Create trigger event

    • Execution results : chooseInclude,enterstopped

    • Execute : chooseStart Nginxalt text

  3. Stop Nginx for testing

    ExistAPP Storein, findNginxGo to administration to stop it

    ClickExecutePerform tasks and viewLog, check whether starting Nginx is successfully executed

    alt text

Script library

Built-in script library

alt text

  • Create Script :Create a script

  • Name : script name

  • Type : Script type:bashorpython

  • Return type : Script return type:FloatorStringorInteger

  • Remark : Script notes

  • Create time : Script creation time

  • Last execute time : Last execution time of the script

  • Execute : Execute this script immediately

  • Edit : Edit script

  • Log : View logs and check script execution results

  • Delete : delete script

Create Script

alt text

  • Name : Enter script name

  • Return type : Script return type:FloatorStringorInteger

  • Script args : Whether script parameters, prompts and instructions are required

  • Remark : Script notes

Feedback or Suggestions

If you encounter problems or suggestions during use, please contact us through the following methods:

  • (Please describe in detail or provide screenshots)
  1. Forum: https://www.aapanel.com/forum
  2. Email: [email protected]