This package has been deprecated

Author message:

Moved to @0x4447/hotpepper

tosystemd

1.4.4Β β€’Β PublicΒ β€’Β Published

downloads


toSystemD

If you work with NodeJS projects and prefer to run them on a Linux box using SystemD as the process manager. Then this small project will help you save a lot of time by creating the .service file for you, based on the content of the package.json file and the location in which the CLI was executed.

How to run

Run the tosystemd command in the directory where you project is located, and if all the necessary data is present in the package.json file, the tool will

  • generate a .service file which will be saved in the right systemD directory.
  • Then it will force systemD to reload the service files.
  • it will the start your server.
  • finally it will tell systemD to start your server every time the system boots.

Example .service file

[Unit]
Description=example.com
Documentation=https://github.com/user/example.com
After=network.target

[Service]
EnvironmentFile=/home/admin/example.com/.env
Type=simple
User=admin
Group=admin
WorkingDirectory=/home/admin/example.com
ExecStart=/usr/bin/node bin/server
StandardOutput=syslog
StandardError=syslog
SyslogIdentifier=example.com
Restart=on-failure
RestartSec=3
KillMode=process
ExecReload=/bin/kill -HUP $MAINPID

[Install]
WantedBy=multi-user.target

Once complete this app will let you know if the process was successful or not.

Where are the logs?

To see the logs of your servers, just run this command: sudo tail -f /var/log/syslog. Each log entry have the name of the project attached to it.

Benefits of using SystemD

When you work on a project that has many micro-services you run in a situation that you have to start many servers just to work on a single one. Using SystemD I know that all the necessary servers are always running in the background. Another key benefit is that this servers will start automatically when you restart the system. So know you don't have to spend time starting everything all over gain.

The End

If you've enjoyed this article/project, please consider giving it a 🌟 or donate.

  • Donate
  • Star on GitHub
  • Watch on GitHub

Also check out my GitHub account, where I have other articles and apps that you might find interesting.

Where to follow

You can follow me on social media πŸ™πŸ˜‡, at the following locations:

More about me

I don’t only live on GitHub, I try to do many things not to get bored πŸ™ƒ. To learn more about me, you can visit the following links:

Package Sidebar

Install

npm i tosystemd

Weekly Downloads

4

Version

1.4.4

License

MIT

Last publish

Collaborators

  • davidgatti