Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Next revision
Previous revision
laptopwiki:guides:os:linux:npmsystemdservice [07/01/2023 22:51] – created dustojnikhummerlaptopwiki:guides:os:linux:npmsystemdservice [13/02/2023 13:04] (current) – [Using a Service File] dustojnikhummer
Line 23: Line 23:
 WantedBy=multi-user.target </code> WantedBy=multi-user.target </code>
   - Copy this file to /etc/systemd/system <code> sudo cp myapp.service /etc/systemd/system </code>   - Copy this file to /etc/systemd/system <code> sudo cp myapp.service /etc/systemd/system </code>
-  - Edit your main.js to include to contain <code>  sudo journalctl -u stickybot.service </code> on the very first line+  - Edit your main.js to include to contain <code> #!/usr/bin/env node </code> on the very first line
   - (Optional but recommended) Convert this file to Unix format. This should prevent incompatibles from [[https://stackoverflow.com/questions/30344858/node-script-executable-not-working-on-mac-env-node-r-no-such-file-or-directo|different carriage return behaviors between Windows and Linux]]   - (Optional but recommended) Convert this file to Unix format. This should prevent incompatibles from [[https://stackoverflow.com/questions/30344858/node-script-executable-not-working-on-mac-env-node-r-no-such-file-or-directo|different carriage return behaviors between Windows and Linux]]
     - Install dos2unix <code> sudo apt install dos2unix</code>     - Install dos2unix <code> sudo apt install dos2unix</code>
Line 30: Line 30:
   - See status of your app <code> sudo systemctl status myapp.service </code>   - See status of your app <code> sudo systemctl status myapp.service </code>
 ==== Stickybot example ==== ==== Stickybot example ====
-<code>cat /etc/systemd/system/stickybot.service</code>+ 
 +<code>cat /etc/systemd/system/stickybot.service 
 + 
 +</code> 
 <code>[Unit] <code>[Unit]
 Description=Stickybot Description=Stickybot
  • laptopwiki/guides/os/linux/npmsystemdservice.1673128260.txt.gz
  • Last modified: 07/01/2023 22:51
  • by dustojnikhummer