Files and scheduled tasks
Upload, edit, compress and extract files with the file manager, and run commands in the container on a cron schedule.
This guide covers two tabs on the Dedicated Container page, 文件管理 (Files) and 计划任务 (Scheduled tasks). It explains how to upload, edit, compress and extract files, and how to run commands on a schedule inside the container.
File manager
Open the container page and switch to the 文件管理 (Files) tab. The file manager's root / is the container's site and application directory, /var/www/html. You can browse and change only this directory and its subdirectories.
Browsing and editing
- Click a directory name to open it. Use the breadcrumb path at the top to go back up.
- The list shows 名称 (Name), 大小 (Size), modification time and 权限 (Permissions).
- Click the More (
⋯) button next to a file for these actions:
| Action | Description |
|---|---|
| 编辑 (Edit) | Open a text file in the browser, change it and save |
| 下载 (Download) | Download the file to your computer |
| 重命名 (Rename) | Rename a file or directory |
| 压缩 (Compress) | Pack a file or directory as tar.gz or zip |
| 解压 (Extract) | Shown only for .tar.gz and .zip files. Extracts into a directory with the archive's name |
| 删除 (Delete) | Delete a file or directory. This can't be undone |
Creating, uploading and remote download
The toolbar has these buttons:
- 上传 (Upload): upload a local file into the current directory.
- 远程下载 (Remote download): enter a 下载URL (Download URL), such as
https://example.com/file.zip, and a 保存文件名 (Save as) name. The server downloads the file straight into the current directory. The download runs in the background with a progress indicator, and "远程下载完成" (Remote download complete) appears when it finishes. - 新建 (New): choose a type (file or directory) and enter a name.
- 刷新 (Refresh): reload the current directory.
If your project has many small files (for example a Node.js app with node_modules), pack it as a .zip or .tar.gz on your computer, upload it or fetch it with Remote download, then 解压 (Extract) it here. This is much faster than uploading files one by one.
Compression and extraction also run in the background. You'll see "压缩完成" (Compression complete) or "解压完成" (Extraction complete) when they finish.
File permissions
Apps and scheduled cron jobs run as the container's www user. If you run into permission problems, click 修复权限 (Fix permissions) under 快捷操作 (Quick actions) on the 概览 (Overview) tab. This resets the owner and permissions of /var/www/html.
Scheduled tasks (cron)
The 计划任务 (Scheduled tasks) tab runs commands inside the container on a cron schedule. Typical uses are running the Laravel scheduler, clearing caches or taking periodic backups.
Creating a scheduled task
Switch to the 计划任务 (Scheduled tasks) tab and click 新建任务 (New task).
Fill in the form:
Field Description 任务名称 (Task name) A name that helps you recognise the task, e.g. backup_database执行计划 (Cron表达式) (Schedule) A standard 5-field cron expression: minute, hour, day of month, month, day of week, e.g. */5 * * * *. Use 快速选择 (Quick select) to pick a common preset执行命令 (Command) The command to run. Use absolute paths, e.g. /usr/bin/php /var/www/html/artisan schedule:run执行用户 (Run as) The user that runs the command 描述 (Description) Optional notes Save. The task then appears in the list.
New tasks start out disabled. After you create a task, turn on its switch in the 状态 (Status) column, or it won't run on schedule. After you edit a task, check that the switch is still set to 启用 (Enabled).
Cron expressions
An expression has five fields with these ranges:
| Field | Range |
|---|---|
| Minute | 0–59 |
| Hour | 0–23 |
| Day of month | 1–31 |
| Month | 1–12 |
| Day of week | 0–7 (both 0 and 7 mean Sunday) |
Common examples:
* * * * * every minute
*/5 * * * * every 5 minutes
0 * * * * at the top of every hour
0 0 * * * every day at 00:00
0 12 * * * every day at 12:00
0 0 * * 1 every Monday at 00:00
0 0 1 * * on the 1st of every month at 00:00Managing tasks
The list shows 执行计划 (Schedule), 命令 (Command), 执行用户 (Run as) and 状态 (Status). Each row has these controls:
- Status switch: enable or disable the task.
- 立即执行 (Run now) (the play icon): run the command once right away and show its output. This is useful for debugging.
- 编辑 (Edit): change the schedule, command and other fields.
- 删除 (Delete): delete the task after you confirm.
Writing good commands
- Scheduled runs use the container's
wwwuser, so that user must be able to read and write the files your command uses. - Don't put single quotes (
') in the command. For complex logic, put the commands in a script such as/var/www/html/cron.shand have the task runsh /var/www/html/cron.sh. - To keep a record of each run, redirect the output yourself, e.g.
... >> /var/www/html/storage/cron.log 2>&1.
About the web terminal
The container page also has a Web终端 (Web terminal) tab.
At the time of writing, this guide doesn't cover the interactive terminal. For day-to-day work, use the file manager, cron's 立即执行 (Run now) and the logs in App management.