I need to create a service that will automatically start my Rails server. Since the rails server
command works correctly only in the application directory, I use the /lib/systemd/system/dev.fhc.name.service
file with the following content:
[Unit]
Description=Puma development server for fhc.name domain
[Service]
ExecStart=cd /home/fhc/www && screen -dmS dev.fhc.name rails server -u puma -e development -p 3001
ExecStop=screen -X -S dev.fhc.name quit
Type=idle
KillMode=process
SyslogIdentifier=dev-fhc-name
SyslogFacility=daemon
Restart=on-failure
[Install]
WantedBy=multi-user.target
However, trying to run it:
sudo systemctl start dev.fhc.name
Leads to an error:
Aug 25 23:00:51 fhc.name systemd[1]: /lib/systemd/system/dev.fhc.name.service:5: Executable "cd" not found in path "/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin"
What am I doing wrong?