cp to basedir
This commit is contained in:
@@ -244,7 +244,13 @@ def generate_crontab(devices, global_config):
|
||||
with open(output_file, 'w', encoding='utf-8') as f:
|
||||
f.write(content)
|
||||
|
||||
print(f"[生成] {output_file}")
|
||||
# 同时复制到 base_dir 目录
|
||||
base_dir = global_config['base_dir']
|
||||
target_file = os.path.join(base_dir, 'crontab.txt')
|
||||
with open(target_file, 'w', encoding='utf-8') as f:
|
||||
f.write(content)
|
||||
|
||||
print(f"[生成] {output_file} -> {target_file}")
|
||||
return output_file
|
||||
|
||||
|
||||
@@ -278,12 +284,20 @@ def generate_control_script(devices, global_config):
|
||||
content = content.replace('{python_path}', global_config['python_path'])
|
||||
content = content.replace('{device_defs}', device_defs)
|
||||
|
||||
# 生成到项目根目录
|
||||
output_file = 'control.sh'
|
||||
with open(output_file, 'w', encoding='utf-8') as f:
|
||||
f.write(content)
|
||||
|
||||
os.chmod(output_file, 0o755)
|
||||
print(f"[生成] {output_file}")
|
||||
|
||||
# 同时复制到 base_dir 目录
|
||||
base_dir = global_config['base_dir']
|
||||
target_file = os.path.join(base_dir, 'control.sh')
|
||||
with open(target_file, 'w', encoding='utf-8') as f:
|
||||
f.write(content)
|
||||
os.chmod(target_file, 0o755)
|
||||
|
||||
print(f"[生成] {output_file} -> {target_file}")
|
||||
return output_file
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user