HOWTO Create a Service: Difference between revisions

From Pumping Station One
Wikibot (talk | contribs)
m Robot: Cosmetic changes
 
(3 intermediate revisions by 2 users not shown)
Line 1: Line 1:
== Why do it this way? ==  
== Why do it this way? ==


* Your service will be watchdogged by systemd
* Your service will be watchdogged by systemd
* Your service will recover from network and power outages.
* Your service will recover from network and power outages.
* It allows other member's to help maintain your service, or disable it cleanly if it need attention.
* It allows other members to help maintain your service, or disable it cleanly if it need attention.
* It's great for IRC bots
* It's great for IRC bots


Line 23: Line 23:




The creates a user named <code>strup</code>. The -b indicates the base home directory is /srv/, and therefore the system accounts home directory is /srv/strup/
The creates a user named <code>strup</code>. The -b indicates the base home directory is /srv/, and therefore the system accounts home directory is /srv/strup/


== Working with SystemD ==
== Working with SystemD ==
Line 62: Line 62:


     sudo su strup
     sudo su strup
Your are now running as the user ''strup'', but you are now in the user's home directory. Running <code>cd</code> without parameters will switch to the current user's home directory.
     cd
     cd


My example requires a file from project gutenberg.
My example requires a file from project gutenberg.