pnpm run dev as service in ubuntu
To run pnpm run dev as a service in Ubuntu, you can follow the steps below:
-
Create a new systemd service file for your project using the command:
sudo nano /etc/systemd/system/my-project.serviceReplace
my-projectwith the name of your project. -
Add the following content to the service file:
[Unit] Description=My Project Service After=network.target [Service] User=<username> WorkingDirectory=/path/to/project ExecStart=/usr/bin/pnpm run dev Restart=always [Install] WantedBy=multi-user.targetReplace
<username>with your username and/path/to/projectwith the path to your project directory. -
Save and close the file.
-
Reload the systemd daemon to read the new service file:
sudo systemctl daemon-reload -
Enable the service to start automatically on boot:
sudo systemctl enable my-project.service -
Start the service:
sudo systemctl start my-project.serviceYou can check the status of the service using the command:
sudo systemctl status my-project.serviceIf everything is configured correctly, you should see that the service is active and running.
原文地址: https://www.cveoy.top/t/topic/MxZ 著作权归作者所有。请勿转载和采集!