I need help with converting an upstart .conf into a systemd .service. Essentially what my .conf file does is this:
exec su -l foo -c 'cd /var/www/path/to/file ; bundle exec puma -C config/puma.rb'
As far as I can tell, we are running the command as root, and then creating a login shell using our "user":
root 1 0.0 0.0 5 7 ? Ss Date 0:00 su -l foo -c cd /var/www/path/to/file ; bundle exec puma -C config/puma.rb
foo 2 0.0 0.0 6 8 ? Ss Date 0:00 -su -c cd /var/www/path/to/file ; bundle exec puma -C config/puma.rb
This is what I have so far with my systemd .service file:
[Unit] Description=simple boot on start After=network.target [Service] Type=simple User=foo WorkingDirectory=/var/www/path/to/file ExecStart=/usr/bin/sudo /bin/bash -lc 'bundle exec puma -C /var/www/path/to/file/config/puma.rb' Restart=always [Install] WantedBy=multi-user.target
I know this is wrong, but it works...sort of. In the sense that I get the process to run, but as root. Not running the command as root to run the process as the "user":
root 3 0.0 0.0 4 5 ? Ss Date 0:00 /usr/bin/sudo /bin/bash -lc bundle exec puma -C /var/www/path/to/file/config/puma.rb
This is pretty new to me at a new job, so trying to find may around this system. Any help is appreciated.