Karsh
Karsh

Reputation: 19

Error starting a tmuxinator session via systemd service on Ubuntu 18.04

I have a tmuxinator (note not tmux, tmuxinator) project running on Ubuntu 18.04 (running in headless/server mode). My tmuxinator project file is located in the default directory of /home/karsh/.tmuxinator/testProject.yml. When I am SSH'ed into the system and just run tmuxinator start testProject via the terminal, everything runs normally and a new Tmux session gets launched with my project configurations.

My goal is to run this command automatically when the computer boots up. My approach was to create a systemd service file located at /etc/systemd/system/testProject.service with the following settings:

[Unit]
Description=Test Project

[Service]
Type=forking
ExecStart=/usr/bin/tmuxinator start testProject

[Install]
WantedBy=multi-user.target

However, when I start this service via sudo systemctl start testProject.service, it crashes. Upon checking status using sudo systemctl status testProject.service, I get the following errors:

● testProject.service - Test Project
   Loaded: loaded (/etc/systemd/system/testProject.service; enabled; vendor preset: enabled)
   Active: failed (Result: exit-code) since Fri 2022-04-08 06:08:43 CST; 8s ago
  Process: 3298 ExecStart=/usr/bin/tmuxinator start testProject (code=exited, status=1/FAILURE)
 Main PID: 32756 (code=exited, status=1/FAILURE)

4月 08 06:08:43 nvidia-desktop systemd[1]: Starting Test Project
4月 08 06:08:43 nvidia-desktop tmuxinator[3298]: Project testProject doesn't exist.
4月 08 06:08:43 nvidia-desktop systemd[1]: testProject.service: Control process exited, code=exited status=1
4月 08 06:08:43 nvidia-desktop systemd[1]: testProject.service: Failed with result 'exit-code'.
4月 08 06:08:43 nvidia-desktop systemd[1]: Failed to start Test Project.

It seems that when running via systemd, tmuxinator is not able to locate /home/karsh/.tmuxinator/testProject.yml file and says that the project does not exist.

How can I give systemd access to the /home/<user>/ directories, assuming that's the problem?

Upvotes: 0

Views: 386

Answers (0)

Related Questions