install startup script on MacOS; fixes #3684
Costa Tsaousis (ktsaou) committed
May 8, 2018 at 11:16 UTC
f87ac0fbaee037198730a71985fd57c3e2edf065
3 files changed
+27
installer/functions.sh
+10
@@ -493,6 +493,16 @@ install_non_systemd_init() {
493
then
494
echo >&2 "file '/etc/init.d/netdata' already exists."
495
return 0
496
+ elif [[ "${key}" =~ ^MacOS.* ]]
497
+ then
498
+ if [ -f "/Library/LaunchDaemons/com.github.netdata.plist" ]
499
+ then
500
+ echo >&2 "file '/Library/LaunchDaemons/com.github.netdata.plist' already exists."
501
+ else
502
+ echo >&2 "Installing MacOS X plist file..."
503
+ run cp system/netdata.plist /Library/LaunchDaemons/com.github.netdata.plist && \
504
+ run launchctl load /Library/LaunchDaemons/com.github.netdata.plist
505
+ fi
506
else
507
echo >&2 "I don't know what init file to install on system '${key}'. Open a github issue to help us fix it."
508
fi
system/Makefile.am
+3
@@ -9,6 +9,7 @@ CLEANFILES = \
9
netdata-init-d \
10
netdata-lsb \
11
netdata-freebsd \
12
+ netdata.plist \
13
$(NULL)
14
15
include $(top_srcdir)/build/subst.inc
@@ -22,6 +23,7 @@ nodist_noinst_DATA = \
23
netdata-init-d \
24
netdata-lsb \
25
netdata-freebsd \
26
+ netdata.plist \
27
$(NULL)
28
29
dist_noinst_DATA = \
@@ -31,5 +33,6 @@ dist_noinst_DATA = \
33
netdata-init-d.in \
34
netdata-lsb.in \
35
netdata-freebsd.in \
36
+ netdata.plist.in \
37
netdata.conf \
38
$(NULL)
system/netdata.plist.in
new
+14
@@ -0,0 +1,14 @@
1
+<?xml version="1.0" encoding="UTF-8"?>
2
+<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
3
+<plist version="1.0">
4
+<dict>
5
+ <key>Label</key>
6
+ <string>com.github.netdata</string>
7
+ <key>ProgramArguments</key>
8
+ <array>
9
+ <string>@sbindir_POST@/netdata</string>
10
+ </array>
11
+ <key>RunAtLoad</key>
12
+ <true/>
13
+</dict>
14
+</plist>