/ user / scripts / strategies.service
strategies.service
 1  [Unit]
 2  Description=Planar Strategies
 3  After=network-online.target
 4  
 5  [Service]
 6  # Use 'forking' because tmux new-session -d detaches
 7  Type=forking
 8  # Help systemd find the main PID of the tmux server process
 9  GuessMainPID=yes
10  
11  # This script will be run inside the tmux session.
12  # We add 'read' at the end to keep the tmux pane open after the script finishes.
13  # # modify the exestart such that it first calls tmux start-server
14  ExecStart=/usr/bin/bash -ic "/usr/bin/tmux new -d -s strategies 'bash \"%h/scripts/strategies.sh\"'"
15  
16  # command to stop the service: Kill the tmux session
17  ExecStop=/usr/bin/tmux kill-session -t strategies
18  
19  # Optional: Restart the service if the tmux server process fails unexpectedly
20  # Note: This might restart the service if the tmux server dies, but
21  # not if just the script inside the tmux session crashes (due to 'read').
22  Restart=on-failure
23  
24  # Optional: Set working directory
25  WorkingDirectory=%h/dev/Planar.jl
26  
27  # Standard output/error will go to the systemd journal by default
28  StandardOutput=journal
29  StandardError=journal
30  
31  [Install]
32  # Enable the service to start automatically at boot
33  WantedBy=multi-user.target