You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

如何在分离的tmux会话中运行多函数文件中的指定TDM函数?

Run TDM Function in Detached tmux Session (Ubuntu 16.04/Bash)

Got it, let's break down exactly how to run your TDM function (the one that temporarily opens phpMyAdmin permissions for 2 hours) in a detached tmux session on your Ubuntu 16.04 system. Here's your step-by-step guide:

1. Ensure tmux is installed

First, check if tmux is already on your system. If not, install it with:

sudo apt update && sudo apt install tmux

2. Run the TDM function in a detached tmux session

Assuming your script file (with the TDM function) is located at /path/to/your/script.sh (replace this with your actual file path), use this command:

tmux new-session -d -s temp_pma_session 'source /path/to/your/script.sh && TDM'

Let's break down what each part does:

  • -d: Starts the session in detached mode (so it runs in the background without taking over your current terminal)
  • -s temp_pma_session: Names the session temp_pma_session (you can change this to any name you prefer)
  • source /path/to/your/script.sh: Loads your script into the tmux session's environment, making the TDM function available
  • && TDM: Executes the TDM function right after loading the script

3. Verify the session is running

To confirm the tmux session is active, run:

tmux list-sessions

You should see temp_pma_session listed in the output.

4. Optional: Check the session output later

If you want to check if the function is running correctly or view any output, you can attach to the session with:

tmux attach-session -t temp_pma_session

To detach from the session and return to your original terminal, press Ctrl+B followed by D.

Notes

  • Make sure your TDM function includes the logic to revert the phpMyAdmin permissions back to 000 after 2 hours (since that's its intended purpose)
  • If the TDM function runs as a background process, the tmux session might exit once the function finishes. If you want to keep the session alive, you can modify the command to add a shell at the end, like:
    tmux new-session -d -s temp_pma_session 'source /path/to/your/script.sh && TDM; bash'
    

内容的提问来源于stack exchange,提问作者Arcticooling

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.05.19 08:41:56