[Feature]: LGSM would utilize user-provided file for CRONTAB jobs
维护者通常 1 天内回复
还没有人认领这个 Issue。
评估
调研方向
从 app/lgsm/modules/command_start.sh 开始,该文件中 issue 的 proof of concept 会导入 ${HOME}/.crontab,并检查 config-lgsm/_default.cfg 以了解建议的共享配置方案。确认启动过程当前如何创建计划任务,并将完成标准定义为:始终加载用户提供的 CRONTAB 文件,而无需在重启后手动编辑控制台。
由索引模型根据 Issue 内容生成。
描述
User story
As a LGSM user, I want LGSM to create its instance of CRONTAB jobs from a user-provided file to allow customization & rapid (re)deployment
Game
7Days2Die
Linux distro
Ubuntu 22.04
Command
command: console
Further information
Would like to be able to create a file {EG: '.crontab'} in the /DATA folder that, if present, will be used to generate that docker's instance of all scheduled jobs via CRONTAB.
As, upon every STOP/START+ of the container, I have to manually modify CRONTAB via the console (miss a few & becomes quite tedious, running multiple servers) since it resets.
Keep the .YML clean(er) as well.
Default upon starting-up:
linuxgsm@599e2cfa8d46:/app$ crontab -l
*/60 * * * * /app/sdtdserver update > /dev/null 2>&1
vs. (mock code change)
[ -f "${CRONTAB_FILE}" ]]; then
cat /data/.config|crontab -
fi
Giving (mock from file):
linuxgsm@599e2cfa8d46:/app$ crontab -l
## EVERY SUN @ 00:00
0 0 * * 0 /usr/bin/truncate --size 0 /data/log/crontab.log /data/log/rcon.log
## EVERY SUN @ 00:30
30 0 * * 0 /app/*server update-lgsm >> /data/log/crontab.log 2>&1
## EVERY DAY @ 05:00
1 5 * * * /data/RCON/rcon_send_backup_msg.sh sdtd 1 >> /data/log/crontab.log 2>&1
2 5 * * * /data/my_backup.sh >> /data/log/crontab.log 2>&1
## EVERY M,W,F @ 05:30
0 5 * * 1,3,5 /data/RCON/rcon_send_reboot_msg.sh sdtd 30 >> /data/log/crontab.log 2>&1
15 5 * * 1,3,5 /data/RCON/rcon_send_reboot_msg.sh sdtd 15 >> /data/log/crontab.log 2>&1
20 5 * * 1,3,5 /data/RCON/rcon_send_reboot_msg.sh sdtd 10 >> /data/log/crontab.log 2>&1
25 5 * * 1,3,5 /data/RCON/rcon_send_reboot_msg.sh sdtd 5 >> /data/log/crontab.log 2>&1
29 5 * * 1,3,5 /data/RCON/rcon_send_reboot_msg.sh sdtd 1 >> /data/log/crontab.log 2>&1
30 5 * * 1,3,5 /app/*server restart >> /data/log/crontab.log 2>&1
Edit (6/9/24)
Hand-jammed a proof of concept:
sudo nano /app/lgsm/modules/command_start.sh
Find:
fn_print_dots "${servername}"
if [ "${shortname}" == "jk2" ]; then
fn_start_jk2
else
fn_start_tmux
fi
New code to add just below:
# If user defined CRONTAB is present, ingest
if [ -f "${HOME}/.crontab" ]; then
fn_script_log_info "Importing CRONTAB file"
cat "${HOME}/.crontab" | crontab -
else
fn_script_log_info "No CRONTAB file to import"
fi
Post-Addition:
...
fn_print_dots "${servername}"
if [ "${shortname}" == "jk2" ]; then
fn_start_jk2
else
fn_start_tmux
fi
# If user defined CRONTAB is present, ingest
#
# Better to utilize 'config-lgsm/_default.cfg' for cross-server usage, ease of use?
#
if [ -f "${HOME}/.crontab" ]; then
fn_script_log_pass "Importing CRONTAB file"
cat "${HOME}/.crontab" | crontab -
else
fn_script_log_info "No CRONTAB file to import"
fi
# Remove starting lockfile when command ends.
...
Test output:
Jun 09 13:42:24.719 pwserver: START: PASS: Started LinuxGSM
Jun 09 13:42:24.822 pwserver: START: PASS: Started LinuxGSM
Jun 09 13:42:24.824 pwserver: START: PASS: Importing CRONTAB file
Jun 09 13:42:24.834 pwserver: RESTART: INFO: LinuxGSM version: v24.2.1
Jun 09 13:42:24.835 pwserver: RESTART: PASS: core_exit.sh exiting with code: 0
- 主要语言
- Shell
- 星标
- 4.9k
- 派生
- 866
- 平均合并
- 17 小时 58 分钟
- 30 天内合并 PR
- 100
环境准备
在浏览器里用你自己的 GitHub 账号启动这个项目的开发容器。
- 没有 Dockerfile 或 Docker Compose 文件
- 有 Pull Request 模板
- 阅读贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
GameServerManagers/LinuxGSM 的其他 Issue
-
command: update-lgsm distro: Debian engine: source2 game: Counter-Strike 2 regression: yes reproducible: always severity: low type: bug
难度 2/5 1-3 小时 新手友好度 84/100
GameServerManagers/LinuxGSM#5242 ·
维护者通常 1 天内回复
-
distro: Debian distro: Ubuntu engine: spark game: Natural Selection 2 priority: high scope: single game type: feature
难度 4/5 3-5 天 新手友好度 45/100
GameServerManagers/LinuxGSM#5241 ·
维护者通常 1 天内回复
-
command: send distro: Ubuntu engine: spark game: Natural Selection 2 priority: high scope: single game type: feature
难度 4/5 3-5 天 新手友好度 48/100
GameServerManagers/LinuxGSM#5240 ·
维护者通常 1 天内回复
-
command: monitor distro: Ubuntu engine: spark game: Natural Selection 2 info: query reproducible: unable severity: critical type: bug
难度 3/5 1-2 天 新手友好度 35/100
GameServerManagers/LinuxGSM#5238 ·
维护者通常 1 天内回复
-
engine: null game: Teamspeak 3
难度 3/5 半天 新手友好度 66/100
GameServerManagers/LinuxGSM#5237 ·
维护者通常 1 天内回复
查看 GameServerManagers/LinuxGSM 的全部 Issue
相似的 Issue
-
enhancement good first issue
难度 2/5 1-3 小时 新手友好度 78/100
-
难度 2/5 1-3 小时 新手友好度 84/100
varnish/helm-varnish#173 ·
维护者通常 2 天内回复
-
难度 2/5 1-3 小时 新手友好度 68/100
-
📦 Update Request
难度 2/5 1-3 小时 新手友好度 65/100
维护者通常 3 天内回复
-
good first issue help wanted testing
难度 1/5 1 小时以内 新手友好度 78/100