Daemon
Process daemon
build
git clone https://git.aixiao.me:443/aixiao/libconf.git
git clone https://git.aixiao.me:443/aixiao/daemon.git
cd libconf
make clean; make
cd ../daemon
make clean; make
HELP
root@NIUYULING:/mnt/c/Users/niuyuling/Desktop/conf# ./daemon -?
Process daemon
Author: AIXIAO@AIXIAO.ME
Usage: [-?h] [-c filename]
Options:
-c : set configuration file, (default: daemon.conf)
-? -h : help information
root@NIUYULING:/mnt/c/Users/niuyuling/Desktop/conf#
配置文件示列:
global {
PROCESS="ls" -> "ls -al"; // 要执行的命令和进程名, 依'" -> "'为分界, '" -> "'之前的字符为进程名字, '" -> "'之后的字符串为要执行的命令.(PROCESS配置理论可以有无数个, 通过链表存储)
PROCESS="ls1" -> "ls -al"; // 同上
PROCESS="id" -> "id"; // 同上
TIME = "10"; // 循环时间, 单位秒. 大于等于1
LOGFILE = "log_daemon.txt"; // 日志文件
}