Skip to content

Commit fa8ad54

Browse files
authored
refactor(script): TorrServer service configuration for macOS (#630)
- update plist configuration to improve service management - add KeepAlive and ThrottleInterval settings - reduce sleep timeout Signed-off-by: Pavel Pikta <devops@pavelpikta.com>
1 parent 0541636 commit fa8ad54

File tree

1 file changed

+17
-6
lines changed

1 file changed

+17
-6
lines changed

installTorrServerMac.sh

Lines changed: 17 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -123,10 +123,6 @@ function installTorrServer() {
123123
<string>${serviceName}</string>
124124
<key>ServiceDescription</key>
125125
<string>TorrServer service for MacOS</string>
126-
<key>LaunchOnlyOnce</key>
127-
<true/>
128-
<key>RunAtLoad</key>
129-
<true/>
130126
<key>ProgramArguments</key>
131127
<array>
132128
<string>${dirInstall}/TorrServer-darwin-${architecture}</string>
@@ -138,10 +134,25 @@ function installTorrServer() {
138134
<string>${dirInstall}/torrserver.log</string>
139135
<string>--httpauth</string>
140136
</array>
137+
<key>RunAtLoad</key>
138+
<true/>
139+
<key>KeepAlive</key>
140+
<dict>
141+
<key>SuccessfulExit</key>
142+
<false/>
143+
</dict>
144+
<key>ProcessType</key>
145+
<string>Background</string>
146+
<key>ThrottleInterval</key>
147+
<integer>10</integer>
148+
<key>AbandonProcessGroup</key>
149+
<true/>
141150
<key>StandardOutPath</key>
142151
<string>${dirInstall}/torrserver.log</string>
143152
<key>StandardErrorPath</key>
144153
<string>${dirInstall}/torrserver.log</string>
154+
<key>WorkingDirectory</key>
155+
<string>${dirInstall}</string>
145156
</dict>
146157
</plist>
147158
EOF
@@ -156,7 +167,7 @@ EOF
156167
[[ $lang == "en" ]] && echo " HTTP Auth Install choosen" || echo " Вы выбрали установку с авторизацией"
157168
[[ ! -f "$dirInstall/accs.db" ]] && {
158169
echo ""
159-
[[ $lang == "en" ]] && read -p ' User: ' answer_user </dev/tty || read -p ' Пользователь: ' answer_user </dev/tty
170+
[[ $lang == "en" ]] && read -p ' User: ' answer_user </dev/tty || read -p ' Пользователь: ' answer_user </dev/tty
160171
isAuthUser=$answer_user
161172
echo ""
162173
[[ $lang == "en" ]] && read -p ' Password: ' answer_pass </dev/tty || read -p ' Пароль: ' answer_pass </dev/tty
@@ -211,7 +222,7 @@ EOF
211222
[[ $lang == "en" ]] && echo " Use user \"$isAuthUser\" with password \"$isAuthPass\" for web auth" || echo " Для авторизации введите пользователя $isAuthUser с паролем $isAuthPass"
212223
echo ""
213224
fi
214-
sleep 30
225+
sleep 10
215226
}
216227

217228
while true; do

0 commit comments

Comments
 (0)