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.

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

报告相同问题?

悬赏问题

  • ¥35 平滑拟合曲线该如何生成
  • ¥100 c语言,请帮蒟蒻写一个题的范例作参考
  • ¥15 名为“Product”的列已属于此 DataTable
  • ¥15 安卓adb backup备份应用数据失败
  • ¥15 eclipse运行项目时遇到的问题
  • ¥15 关于#c##的问题:最近需要用CAT工具Trados进行一些开发
  • ¥15 南大pa1 小游戏没有界面,并且报了如下错误,尝试过换显卡驱动,但是好像不行
  • ¥15 没有证书,nginx怎么反向代理到只能接受https的公网网站
  • ¥50 成都蓉城足球俱乐部小程序抢票
  • ¥15 yolov7训练自己的数据集