Vic*_*tor 14 linux cron gnu-screen gameserver
我想创建一个 crontab 条目,以便它启动屏幕,启动游戏服务器并分离。这是为了以防服务器重新启动并且我希望它自动为我启动它。
0 0 0 0 0(命令)
应该在启动时运行。
它运行一个位于 ~/cube/server.sh 的 shell 文件
Cor*_* S. 18
像这样的事情应该有效。此示例生成一个屏幕并运行“top”:
screen -d -m top
Run Code Online (Sandbox Code Playgroud)
在您的 crontab 中,如图所示,您想要执行以下操作:
@reboot /usr/bin/screen -dmS gameserver-screen /opt/mycoolgame/bin/gameserver
Run Code Online (Sandbox Code Playgroud)
当然,如果游戏服务器需要一个“普通”的环境设置,你可以通过以下方式拉近:
@reboot (. ~/.profile; /usr/bin/screen -dmS gameserver-screen /opt/mycoolgame/bin/gameserver)
Run Code Online (Sandbox Code Playgroud)
这应该足够了...运行
$ crontab -e
Run Code Online (Sandbox Code Playgroud)
然后输入:
@reboot screen -dmS Victor
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
42072 次 |
| 最近记录: |