如何强制gnome-terminal始终为站点范围内的所有用户使用--disable-factory选项?

时间:2022-06-11 06:55:13

My team at work manages a few thousand compute hosts for several thousand users. We have a system in place that allows users to open a terminal "somewhere" in the farm, and keeping the workload level is an important part of it. We depend on being able to to process accounting for each terminal process that is started.

我的团队在工作中为数千名用户管理了几千个计算主机。我们有一个系统,允许用户在服务器场中“某处”打开终端,并保持工作负载级别是其中的一个重要部分。我们依赖于能够处理启动的每个终端进程的计费。

It's common for users to ask for xterm, dtterm, and gnome-terminal processes. gnome-terminal presents a unique challenge for us. When you start a "new" gnome-terminal process, if you already have an "old" gnome-terminal process running in the same user session on the same machine, the "new" process passes the shell command on to the "old" process, and the shell/window are created as part of the "old" process tree; and the "new" process exits. This causes us to have problems with our process accounting, for obvious reasons.

用户通常会要求xterm,dtterm和gnome-terminal进程。 gnome-terminal为我们带来了独特的挑战。当你启动一个“新的”gnome-terminal进程时,如果你已经在同一台机器上的同一个用户会话中运行了一个“旧的”gnome-terminal进程,那么“new”进程会将shell命令传递给“old”进程,shell /窗口是作为“旧”进程树的一部分创建的;并且“新”过程退出。由于显而易见的原因,这导致我们的流程会计出现问题。

This default behavior of gnome-terminal can be stopped by giving the --disable-factory option. But there's no way we can train all our users (8000+) to remember to use this option every time they ask for a gnome-terminal process in the farm. We need to find a way to lock this down so that gnome-terminal always behaves as if the --disable-factory option is given.

可以通过给出--disable-factory选项来停止gnome-terminal的默认行为。但是,我们无法训练所有用户(8000+)记住每次在农场中请求gnome-terminal进程时都使用此选项。我们需要找到一种方法来锁定它,以便gnome-terminal始终表现得好像给出了--disable-factory选项。

Is there a way to configure this for all users, site-wide? We'd prefer not to "wrap" gnome-terminal with a script to inject the option at invocation time, if possible-- that would work, but it's difficult to maintain, and it could be brittle. Adding a key in some /etc/gconf file would be ideal, but I'm not sure what (if any) key would be honored by gnome-terminal...?

有没有办法在全站点为所有用户配置?我们不希望用脚本“包装”gnome-terminal来在调用时注入选项,如果可能的话 - 这样可行,但是很难维护,而且可能很脆弱。在某些/ etc / gconf文件中添加一个键是理想的,但我不确定gnome-terminal会尊重什么(如果有的话)?

Any advice would be appreciated! Thanks

任何意见,将不胜感激!谢谢

1 个解决方案

#1


The most painless way to do this would be using a configuration management tool to modify the gnome-terminal.desktop file to pass the --disable-factory option on the Exec= line. If you want to ensure this isn't affected by OS upgrades I think user specific .desktop files get processed before system ones, so copying this modified .desktop into either the local user's applications directory (or /etc/skel/) or moving the old one to a new different name might work.

最简单的方法是使用配置管理工具修改gnome-terminal.desktop文件,以便在Exec =行上传递--disable-factory选项。如果你想确保它不受操作系统升级的影响,我认为用户特定的.desktop文件会在系统文件之前得到处理,所以将修改后的.desktop复制到本地用户的应用程序目录(或/ etc / skel /)或移动旧的一个新的不同名称可能会起作用。

#1


The most painless way to do this would be using a configuration management tool to modify the gnome-terminal.desktop file to pass the --disable-factory option on the Exec= line. If you want to ensure this isn't affected by OS upgrades I think user specific .desktop files get processed before system ones, so copying this modified .desktop into either the local user's applications directory (or /etc/skel/) or moving the old one to a new different name might work.

最简单的方法是使用配置管理工具修改gnome-terminal.desktop文件,以便在Exec =行上传递--disable-factory选项。如果你想确保它不受操作系统升级的影响,我认为用户特定的.desktop文件会在系统文件之前得到处理,所以将修改后的.desktop复制到本地用户的应用程序目录(或/ etc / skel /)或移动旧的一个新的不同名称可能会起作用。