1Panel
1Panel copied to clipboard
[Bug] When the task name in a scheduled task contains special characters, the execution fails
Contact Information
No response
1Panel Version
2.0.11
Problem Description
计划任务的任务名称包含特殊字符时,bash 在执行 tar 命令时遇到了括号 ( 导致语法错误。
Steps to Reproduce
1。计划任务-创建计划任务 2.任务名称输入:系统盘(sdb)-1panel/docker 3.保存计划任务,点击执行
The expected correct result
No response
Related log output
2025/10/24 00:05:55 执行 [cronjob-系统盘(sdb)-1panel/docker] 任务开始 [START]
2025/10/24 00:05:55 Dir: /opt/1panel/docker, Excludes: lock,.clfs_history,.cache,cache,temp,tmp,.tmp,.temp,.Caches,Caches,.caches,caches,emby-ailg-115.img,/opt/1panel/docker/compose/oneliverec/caddy/data/caddy/locks
2025/10/24 00:05:55 备份 [/opt/1panel/docker] 失败: handle failed, std: stderr: bash: -c: line 1: syntax error near unexpected token `('
bash: -c: line 1: `tar -zcf /opt/1panel/backup/tmp/directory/系统盘(sdb)-1panel/docker/opt_1panel_docker_20251024000555_38.tar.gz --exclude 'lock' --exclude '.clfs_history' --exclude '.cache' --exclude 'cache' --exclude 'temp' --exclude 'tmp' --exclude '.tmp' --exclude '.temp' --exclude '.Caches' --exclude 'Caches' --exclude '.caches' --exclude 'caches' --exclude 'emby-ailg-115.img' --exclude 'compose/oneliverec/caddy/data/caddy/locks' docker'
, err: exit status 2
2025/10/24 00:05:56 开始第 1 次重试
2025/10/24 00:05:56 Dir: /opt/1panel/docker, Excludes: lock,.clfs_history,.cache,cache,temp,tmp,.tmp,.temp,.Caches,Caches,.caches,caches,emby-ailg-115.img,/opt/1panel/docker/compose/oneliverec/caddy/data/caddy/locks
2025/10/24 00:05:56 备份 [/opt/1panel/docker] 失败: handle failed, std: stderr: bash: -c: line 1: syntax error near unexpected token `('
bash: -c: line 1: `tar -zcf /opt/1panel/backup/tmp/directory/系统盘(sdb)-1panel/docker/opt_1panel_docker_20251024000556_fs.tar.gz --exclude 'lock' --exclude '.clfs_history' --exclude '.cache' --exclude 'cache' --exclude 'temp' --exclude 'tmp' --exclude '.tmp' --exclude '.temp' --exclude '.Caches' --exclude 'Caches' --exclude '.caches' --exclude 'caches' --exclude 'emby-ailg-115.img' --exclude 'compose/oneliverec/caddy/data/caddy/locks' docker'
, err: exit status 2
2025/10/24 00:05:57 开始第 2 次重试
2025/10/24 00:05:57 Dir: /opt/1panel/docker, Excludes: lock,.clfs_history,.cache,cache,temp,tmp,.tmp,.temp,.Caches,Caches,.caches,caches,emby-ailg-115.img,/opt/1panel/docker/compose/oneliverec/caddy/data/caddy/locks
2025/10/24 00:05:57 备份 [/opt/1panel/docker] 失败: handle failed, std: stderr: bash: -c: line 1: syntax error near unexpected token `('
bash: -c: line 1: `tar -zcf /opt/1panel/backup/tmp/directory/系统盘(sdb)-1panel/docker/opt_1panel_docker_20251024000557_kf.tar.gz --exclude 'lock' --exclude '.clfs_history' --exclude '.cache' --exclude 'cache' --exclude 'temp' --exclude 'tmp' --exclude '.tmp' --exclude '.temp' --exclude '.Caches' --exclude 'Caches' --exclude '.caches' --exclude 'caches' --exclude 'emby-ailg-115.img' --exclude 'compose/oneliverec/caddy/data/caddy/locks' docker'
, err: exit status 2
2025/10/24 00:05:58 开始第 3 次重试
2025/10/24 00:05:58 Dir: /opt/1panel/docker, Excludes: lock,.clfs_history,.cache,cache,temp,tmp,.tmp,.temp,.Caches,Caches,.caches,caches,emby-ailg-115.img,/opt/1panel/docker/compose/oneliverec/caddy/data/caddy/locks
2025/10/24 00:05:58 备份 [/opt/1panel/docker] 失败: handle failed, std: stderr: bash: -c: line 1: syntax error near unexpected token `('
bash: -c: line 1: `tar -zcf /opt/1panel/backup/tmp/directory/系统盘(sdb)-1panel/docker/opt_1panel_docker_20251024000558_ky.tar.gz --exclude 'lock' --exclude '.clfs_history' --exclude '.cache' --exclude 'cache' --exclude 'temp' --exclude 'tmp' --exclude '.tmp' --exclude '.temp' --exclude '.Caches' --exclude 'Caches' --exclude '.caches' --exclude 'caches' --exclude 'emby-ailg-115.img' --exclude 'compose/oneliverec/caddy/data/caddy/locks' docker'
, err: exit status 2
2025/10/24 00:05:59 [TASK-END]
Additional Information
No response
感谢反馈,下个版本优化该问题!
这里是因为压缩备份文件夹时需要用到这个名称,下个版本限制计划任务名称输入部分特殊字符
2.0.13版本限制了部分特殊字符的输入,之前创建的计划任务需要删除后重新创建方可正常执行
v2.0.13 版本已发布。