# systemd unit — alternative to pm2 for running the agent as a service. # Install: # sudo cp deploy/defentra-agent.service /etc/systemd/system/ # sudo systemctl daemon-reload # sudo systemctl enable --now defentra-agent # sudo systemctl status defentra-agent # check it's running # journalctl -u defentra-agent -f # follow logs # # Adjust User and WorkingDirectory to match where you put the code. [Unit] Description=Defentra LinkedIn Agent After=network-online.target Wants=network-online.target [Service] Type=simple User=www-data WorkingDirectory=/opt/defentra-linkedin-agent ExecStart=/usr/bin/node src/index.js Restart=always RestartSec=5 Environment=NODE_ENV=production # If the server has no system Chrome and Puppeteer's download fails, point this # at an installed Chromium: # Environment=PUPPETEER_EXECUTABLE_PATH=/usr/bin/chromium [Install] WantedBy=multi-user.target