-
Notifications
You must be signed in to change notification settings - Fork 149
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Systemd: Modifications to remove new session after restoration #83
base: master
Are you sure you want to change the base?
Conversation
So, why is
Note that if someone is running tmux plugins in the background via |
It's doing the trick, it start the daemon with creation of a NEW session. |
If you kill the last tmux session, you kill the daemon (on manjaro / ubuntu) |
Sorry, there is an error in my proposal I'm working on strongly solution in regards to my comment #7 (comment) and my difficulties to kill-session inside the starting script ... |
@@ -1,9 +1,10 @@ | |||
#!/usr/bin/env bash | |||
|
|||
CURRENT_DIR="$( dirname ${BASH_SOURCE[0]} )" | |||
PARENT_DIR="${CURRENT_DIR%/*}" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
set a parent properly
@@ -19,7 +20,7 @@ template() { | |||
[Service] | |||
Type=forking | |||
Environment=DISPLAY=:0 | |||
ExecStart=/usr/bin/tmux ${systemd_tmux_server_start_cmd} | |||
ExecStart=${PARENT_DIR}/continuum_start.sh |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Use a local script to start tmux daemon in place a /usr/bin/tmux
local tmux_start_script_path="${CURRENT_DIR}/linux_start_tmux.sh" | ||
local systemd_unit_file=$(template "${tmux_start_script_path}" "${options}") | ||
mkdir -p "$(dirname ${systemd_unit_file_path})" | ||
[ ! -d "$(dirname ${systemd_unit_file_path})" ] && mkdir -p "$(dirname ${systemd_unit_file_path})" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
prevent error when creates existing path (script is executed at each start)
systemd_tmux_server_start_cmd_option="@continuum-systemd-start-cmd" | ||
systemd_tmux_server_start_cmd_default="new-session -d" | ||
systemd_tmux_server_start_cmd_default="new-session -d -s ${tmux_server_session_temporary}" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
starts the daemon with a named session to allow to kill it after starting
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I need to create a named session to allow his deletion after tmux start, otherwise a new session are created at each start of daemon and are added to restored sessions.
If the daemon start with no saved session, I need to create one before to kill the named one, otherwise I kill the server.
To control this deletion of named session I creates a file to control it: 'continuum_start.sh'
You are right about the '-b' option, I made a mistake by forgetting it; o) |
minor correction on creating new session
The purpose of this modification is to allow session restoration on linux: the way are to :
Let plugin script "restore.sh" restore tmux session
After the start of tmux daemon, start simply tmux with the following command in a terminal console :
tmux a
/ attach / attach-sessionor automate the start of tmux in terminal with adding line to the .basrhrc user file:
type tmux &>/dev/null && tmux ls &>/dev/null && [ -z $TMUX ] && [[ ! $TERM =~ screen ]] && tmux attach-session
;o)