0

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?

Karsh
  • 19
  • 3
  • Try either passing the path to the config file using the -p flag (`/usr/bin/tmuxinator start -p /home/karsh/.tmuxinator/testProject.yml`) or by [running the service using your user](https://www.golinuxcloud.com/run-systemd-service-specific-user-group-linux/#Step_4_Create_unit_file_to_run_systemd_service_as_specific_user_and_group). – pdoherty926 Apr 08 '22 at 00:36
  • From the tag: systemd questions should be for *programming questions* using systemd or its libraries. Questions about *configuring the daemon* (including writing unit files) are better directed to Unix & Linux: https://unix.stackexchange.com. – Rob Apr 08 '22 at 09:29

0 Answers0