Jelajahi Sumber

macOS: add launchd sample plist

Nicola Murino 5 tahun lalu
induk
melakukan
7010f513e3
2 mengubah file dengan 29 tambahan dan 1 penghapusan
  1. 3 1
      README.md
  2. 26 0
      init/com.github.drakkan.sftpgo.plist

+ 3 - 1
README.md

@@ -67,12 +67,14 @@ sftpgo -v
 SFTPGo version: 0.9.0-dev-90607d4-dirty-2019-08-08T19:28:36Z
 ```
 
-For Linux, a systemd sample [service](https://github.com/drakkan/sftpgo/tree/master/init/sftpgo.service "systemd service") can be found inside the source tree.
+For Linux, a `systemd` sample [service](https://github.com/drakkan/sftpgo/tree/master/init/sftpgo.service "systemd service") can be found inside the source tree.
 
 Alternately you can use distro packages:
 
 - Arch Linux PKGBUILD is available on [AUR](https://aur.archlinux.org/packages/sftpgo/ "SFTPGo")
 
+For macOS a `launchd` sample [service](https://github.com/drakkan/sftpgo/tree/master/init/com.github.drakkan.sftpgo.plist "launchd plist") can be found inside the source tree. The `launchd` plist assumes that `sftpgo` has `/usr/local/opt/sftpgo` as base directory. 
+
 ## Configuration
 
 The `sftpgo` executable can be used this way:

+ 26 - 0
init/com.github.drakkan.sftpgo.plist

@@ -0,0 +1,26 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
+<plist version="1.0">
+<dict>
+    <key>Label</key>
+    <string>com.github.drakkan.sftpgo</string>
+    <key>EnvironmentVariables</key>
+    <dict>
+        <key>SFTPGO_CONFIG_DIR</key>
+        <string>/usr/local/opt/sftpgo/etc</string>
+        <key>SFTPGO_LOG_FILE_PATH</key>
+        <string>/usr/local/opt/sftpgo/log/sftpgo.log</string>
+    </dict>
+    <key>WorkingDirectory</key>
+    <string>/usr/local/opt/sftpgo/etc</string>
+    <key>ProgramArguments</key>
+    <array>
+        <string>/usr/local/opt/sftpgo/bin/sftpgo</string>
+        <string>serve</string>
+    </array>
+    <key>KeepAlive</key>
+    <true/>
+    <key>ThrottleInterval</key>
+    <integer>10</integer>
+</dict>
+</plist>