From 13d30cd4c781d5dfbfabf451d9232ad09dd341f1 Mon Sep 17 00:00:00 2001 From: AJ ONeal Date: Fri, 26 Jun 2020 07:00:50 +0000 Subject: [PATCH] add launcher examples --- serviceman/README.md | 61 ++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 61 insertions(+) diff --git a/serviceman/README.md b/serviceman/README.md index 53b37b3..57fff04 100644 --- a/serviceman/README.md +++ b/serviceman/README.md @@ -62,6 +62,67 @@ sudo env PATH="$PATH" \ sudo env PATH="$PATH" serviceman add bash ./backup.sh /mnt/data ``` +## What a typical systemd .service file looks like + +```txt +[Unit] +Description=example-service +After=network-online.target +Wants=network-online.target systemd-networkd-wait-online.service + +[Service] +Restart=always +StartLimitInterval=10 +StartLimitBurst=3 + +User=root +Group=root + +WorkingDirectory=/srv/example-service +ExecStart=/srv/example-service/bin/example-command start +ExecReload=/bin/kill -USR1 $MAINPID + +# Allow the program to bind on privileged ports, such as 80 and 443 +CapabilityBoundingSet=CAP_NET_BIND_SERVICE +AmbientCapabilities=CAP_NET_BIND_SERVICE +NoNewPrivileges=true + +[Install] +WantedBy=multi-user.target +``` + +## What a typical launchd .plist file looks like + +```txt + + + + + + Label + example-service + ProgramArguments + + /Users/me/example-service/bin/example-command + start + + + RunAtLoad + + KeepAlive + + + WorkingDirectory + /Users/me/example-service + + StandardErrorPath + /Users/me/.local/share/example-service/var/log/example-service.log + StandardOutPath + /Users/me/.local/share/example-service/var/log/example-service.log + + +``` + ### Use `--dryrun` to see the generated launcher config: ```bash -- 2.25.1