douzi1117 2013-10-08 08:39
浏览 30
已采纳

我应该使用什么过程来构建linux配置页面?

I have a Linux server with some config files that need to be updated by the user, I would like the ability to add entries to these files from a web UI instead of a user editing the files directly.

I will be using bootstrap for the UI.

But I would like to know what would be the approach or best technology to use to keep these files up-to-date or manage their contents.

I have a good understanding of PHP and always used databases for storing information - but I'm lost about how to tackle this.

File one is called jobs.yml looks like this

#Convert Audio
job1:
 label: Convert to Text to MP3
 watch: /home/media/convert_audio/to_mp3
 events: ['write_close', 'move_to']
 recursive: false
 command: /home/media/bin/to_mp3 "$filename"

job12:
 label: Convert to Text to WAV
 watch: /home/media/convert_audio/to_wav
 events: ['write_close', 'move_to']
 recursive: false
 command: /home/media/bin/to_wav "$filename"

File two is actually a collection of bash files or scripts (I guess this could be templated)

#!/bin/bash
o="$1"
o="${o##*/}"
o="${o%.*}"
ffmpeg -i $1 -qscale 0 "/home/media/convert_videos/converted/$o.mpg"
mv "$1" /home/media/convert_videos/processed/

I would ultimately like to Add/Remove and edit entries

  • 写回答

1条回答 默认 最新

  • douzhengzuo7283 2013-10-08 09:17
    关注

    For yml files, there are PHP functions that permit to easily manage them : PHP.net. You can also found libraries which add more features.

    For bash files, they are like other files and you can read/write content with PHP file functions (PHP.net). But you will have to write your own logic to append/remove new lines.

    It maybe a good idea to use a database to store all lines which have to be in each files. You will can rebuild all file content from DB (it will be simpler to add/remove lines).

    To finish, take care of what your users write in your bash files, it's a potential security breach.

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥100 set_link_state
  • ¥15 虚幻5 UE美术毛发渲染
  • ¥15 CVRP 图论 物流运输优化
  • ¥15 Tableau online 嵌入ppt失败
  • ¥100 支付宝网页转账系统不识别账号
  • ¥15 基于单片机的靶位控制系统
  • ¥15 真我手机蓝牙传输进度消息被关闭了,怎么打开?(关键词-消息通知)
  • ¥15 装 pytorch 的时候出了好多问题,遇到这种情况怎么处理?
  • ¥20 IOS游览器某宝手机网页版自动立即购买JavaScript脚本
  • ¥15 手机接入宽带网线,如何释放宽带全部速度