forked from mipmip/zabbix_agentd_osx_installer
-
Notifications
You must be signed in to change notification settings - Fork 0
/
postinstall.sh
39 lines (32 loc) · 1.5 KB
/
postinstall.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
#!/usr/bin/env bash
#To create a group:
sudo dscl /Local/Default -create /Groups/zabbix
sudo dscl /Local/Default -create /Groups/zabbix PrimaryGroupID 113
sudo dscl /Local/Default -create /Groups/zabbix Password \*
#To create a user:
sudo dscl /Local/Default -create /Users/zabbix
sudo dscl /Local/Default -create /Users/zabbix UniqueID 113
sudo dscl /Local/Default -create /Users/zabbix UserShell /usr/bin/false
sudo dscl /Local/Default -create /Users/zabbix RealName 'Zabbix user'
sudo dscl /Local/Default -create /Users/zabbix NFSHomeDirectory /var/empty
sudo dscl /Local/Default -create /Users/zabbix PrimaryGroupID 113
sudo dscl /Local/Default -create /Users/zabbix Password \*
#Create needed directories
sudo mkdir -p /var/run/zabbix-agent
sudo mkdir -p /var/log/zabbix-agent
sudo mkdir -p /usr/local/bin
sudo mkdir -p /usr/local/sbin
sudo mkdir -p /usr/local/etc/zabbix
sudo chown -Rf zabbix:zabbix /var/run/zabbix-agent
sudo chown -Rf zabbix:zabbix /var/log/zabbix-agent
sudo chown root:wheel /Library/LaunchDaemons/com.zabbix.zabbix_agentd.plist
sudo chown root:wheel /usr/local/etc/zabbix/zabbix_agentd.conf
sudo chown root:wheel /usr/local/etc/zabbix_agentd.conf
sudo chown -Rf root:wheel /usr/local/sbin
sudo chown -Rf root:wheel /usr/local/bin
sudo chmod -Rf 755 /usr/local/bin
sudo chmod -Rf 755 /usr/local/sbin
sudo chmod 755 /usr/local/etc/zabbix
#sudo kill -9 `ps aux | grep zabbix_agentd | cut -f11 -d" "`
#sudo kill -9 `ps -aef | grep zabbix_agentd | grep -v grep | awk '{print $2}'`
#sudo rm -Rf /tmp/zabbix*