-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathiworx-oneliners.sh
More file actions
55 lines (42 loc) · 2.15 KB
/
iworx-oneliners.sh
File metadata and controls
55 lines (42 loc) · 2.15 KB
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
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
# Print Server Health Status to screen
nodeworx -u -n -c health -a listHealthStatus | awk '{print $1,$3}' | sed "s/0$/${BRIGHT}${GREEN}GOOD${NORMAL}/g;s/1$/${BRIGHT}${RED}BAD${NORMAL}/g;s/2$/N\/A/g" | column -t
# Print links to Nodeworx service pages
nodeworx -u -n -c Overview -a listServiceStatus | sed 's:, :,:' | awk '{print $1" | https://""'"$(serverName)"'"":2443"$5}' | column -t
# Lookup Siteworx account details
acctdetail(){
nodeworx -u -n -c Siteworx -a querySiteworxAccountDetails --domain $(~iworx/bin/listaccounts.pex | awk "/$(getusr)/"'{print $2}')\
| sed 's:\([a-zA-Z]\) \([a-zA-Z]\):\1_\2:g;s:\b1\b:YES:g;s:\b0\b:NO:g' | column -t
}
# Add an IP to a siteworx account
addip(){
nodeworx -u -n -c Siteworx -a addIp --domain $(~iworx/bin/listaccounts.pex | awk "/$(getusr)/"'{print $2}') --ipv4 $ipAddress
}
# Mark IP as available for Resellers
resellip(){
nodeworx -u -n -c Ip -a edit --ip $ipAddress --is_reseller 1
}
# Enable Siteworx backups
addbackup(){
nodeworx -u -n -c Siteworx -a edit --domain $(~iworx/bin/listaccounts.pex | awk "/$(getusr)/"'{print $2}') --OPT_BACKUP 1
}
# Set number of secondary domains
nodeworx -u -n -c Siteworx -a edit --domain $(~iworx/bin/listaccounts.pex | awk "/$(getusr)/"'{print $2}') --OPT_SLAVE_DOMAINS $num
primarydomain(){ ~iworx/bin/listaccounts.pex | awk "/$(getusr)/"'{print $2}'; }
# List iworx logs
ls /home/interworx/var/log/*.log | column -t
# Iworx DB
i(){
$(grep -B1 'dsn.orig=' ~iworx/iworx.ini | head -1 | sed 's|.*://\(.*\):\(.*\)@.*\(/usr.*.sock\)..\(.*\)"|mysql -u \1 -p\2 -S \3 \4|') "$@"
}
# ProFTPd
f(){
$(grep -A1 '\[proftpd\]' ~iworx/iworx.ini | tail -1 | sed 's|.*://\(.*\):\(.*\)@.*\(/usr.*.sock\)..\(.*\)"|mysql -u \1 -p\2 -S \3 \4|') "$@"
}
# Vpopmail
v(){
$(grep -A1 '\[vpopmail\]' ~iworx/iworx.ini | tail -1 | sed 's|.*://\(.*\):\(.*\)@.*\(/usr.*.sock\)..\(.*\)"|mysql -u \1 -p\2 -S \3 \4|') "$@"
}
# Horde
$(grep -A1 '\[horde\]' ~iworx/iworx.ini | tail -1 | sed 's|.*://\(.*\):\(.*\)@.*\(/usr.*.sock\)..\(.*\)"|mysql -u \1 -p\2 -S \3 \4|')
# Roundcube
$(grep -A1 '\[roundcube\]' ~iworx/iworx.ini | tail -1 | sed 's|.*://\(.*\):\(.*\)@.*\(/usr.*.sock\)..\(.*\)"|mysql -u \1 -p\2 -S \3 \4|')