[Unit] Description=Run sequence.py in tmux sess # wait for network to come up After=network-online.target [Service] Type=oneshot RemainAfterExit=yes User=light Group=light WorkingDirectory=/home/light/bin/dmx # Start a new tmux session named "light" # run Python script in the tmux session ExecStart=/usr/bin/tmux new-session -s light -d "python3 sequence.py" ExecStop=/usr/bin/tmux kill-session -t light [Install] WantedBy=multi-user.target