Categorii
Cum sa

Centos HP Tools

cd /etc/pki/rpm-gpg/
wget http://downloads.linux.hpe.com/SDR/repo/spp/GPG-KEY-spp
wget http://downloads.linux.hpe.com/SDR/repo/mcp/GPG-KEY-mcp

In /etc/yum.repos.d/hp.repo
[HP-spp]
name=HP Service Pack for ProLiant
baseurl=http://downloads.linux.hpe.com/SDR/repo/spp/RHEL/7/x86_64/current/
enabled=1
gpgcheck=0
gpgkey=file:///etc/pki/rpm-gpg/GPG-KEY-ssp

[HP-mcp]
name=HP Management Component Pack for ProLiant
baseurl=http://downloads.linux.hpe.com/SDR/repo/mcp/centos/7/x86_64/current/
enabled=1
gpgcheck=0
gpgkey=file:///etc/pki/rpm-gpg/GPG-KEY-mcp

yum install hpssacli
hpssacli ctrl all show config

Install HP iLO management
yum install hponcfg

Categorii
General

Configurare fisier swap


# initializare
dd if=/dev/zero of=/swapfile count=1024 bs=1M
chown root:root /swapfile
chmod 600 /swapfile
# Make it into a swap file
mkswap /swapfile
# Mount swap file
swapon /swapfile
# configurare fstab pentru a pastra la reboot
cp -av /etc/fstab /etc/fstab.bckp
echo /swapfile swap swap defaults 0 0 >> /etc/fstab # Care!! '>>'

Categorii
Cum sa

Logout Disconnected Remote User Sessions

O varianta este cu un script powershell care il putem rula cu Scheduler in fiecare noapte.
Script-ul powershell:

Write-Host "Ending All Disconnected Remote User Sessions"
$RDSessions = Get-RDUserSession | Where-Object -Filter {$_.SessionState -eq 'STATE_DISCONNECTED'}
If (!$RDSessions){
Write-Output "No Remote User Sessions found "
} Else {
Foreach ($RDSession in $RDSessions){
Invoke-RDUserLogoff -UnifiedSessionID $RDSession.SessionId -HostServer $RDSession.HostServer -Force
Write-Output "The user" $RDSession.UserName "is logged off from" $RDSession.HostServer "server"
}
}

La actiuni Program/Script: C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe
Iar la parametri(arguments): C:\scripts\logoff-disconnected.ps1 – script-ul de mai sus.

Bifam si „Run with highest privileges”

Categorii
Cum sa

Configurare UNMS via SSH EdgeSwitch

Pentru setare cheie UNMS la switch-urile Ubiquiti EdgeSwitch via ssh.
Datele implicite de conectare sunt ubnt/ubnt

enable
configure
service unms key (unms key)
service unms - face enable la serviciul unms
show unms - afisare status

Categorii
Cum sa

List error_log files in /home/user/public_html

find /home/*/public_html/ -maxdepth 1 -type f -iname error_log -size +50M -exec du -sh {} \;

Categorii
General

Verifica domenii pe servere cPanel care nu mai sunt local


for user in $(whmapi1 listaccts | awk '/user:/ {print $2}'); do domain=$(whmapi1 accountsummary user=$user | awk '/domain:/ {print $2}'); assignedip=$(whmapi1 accountsummary user=$user | awk '/ip:/ {print$2}') ; dnsip=$(dig +short $domain); dnsmx=$(dig MX +short $domain @8.8.8.8 | awk '{print $2}' | xargs dig +short); if [[ $dnsip != $assignedip ]]; then echo -n "$user:$domain - A - FAILS"; if [[ "$dnsmx" == "$assignedip" ]]; then echo -e " but MX for $user:$domain does point locally"; else echo ""; fi; fi ; done

Categorii
Cum sa

Verificare LdapSrvPriority si LdapSrvWeight

Pornim nslookup si din consola nslookup:

set q=SRV
_ldap._tcp.dc._msdcs.

Categorii
Cum sa

Activare php-fpm status page pe servere cu plesk

Conditii pentru aceasta varianta:
– server plesk
– nginx ca si proxy pentru apache
– php-fpm binenteles

Cream fisierul /var/www/vhosts/system/numedomeniu/conf/php.ini cu continutul

[php-fpm-pool-settings]
pm.status_path = /status
ping.path = /ping

In plesk la Domains > numedomeniu > Apache & nginx Settings introducem:

location ~ ^/(status|ping)$ {
fastcgi_split_path_info ^((?U).+\\.php)(/?.+)$;
fastcgi_param PATH_INFO $fastcgi_path_info;
fastcgi_pass "unix:///var/www/vhosts/system/numedomeniu/php-fpm.sock";
include /etc/nginx/fastcgi.conf;
}

Actualizam setarile php:

/usr/local/psa/bin/php_settings -u

Putem apela acum in browser:

http://numedomeniu/status

respectiv

http://numedomeniu/status?full

Categorii
Cum sa

Configurare SPF relay extern

Exemplu – pentru implementare mailchannels trebuie actualizata inregistrarea txt in dns-uri sa includa si „include:relay.mailchannels.net”.
for i in `ls /var/cpanel/users` ;
do /usr/local/cpanel/bin/spf_installer $i "include:relay.mailchannels.net" 0 0 1;
done

Categorii
Cum sa

error while loading shared libraries: libxml2.so.2: wrong ELF class: ELFCLASS32

La rulare yum avem eroarea:
error while loading shared libraries: libxml2.so.2: wrong ELF class: ELFCLASS32
Apare atunci cand sunt instalate ambele versiune libxml2 – 32/64bit.
Verificam pachetele instalate:
rpm -qa --queryformat '%{n}-%{v}-%{r}.%{arch}\n' libxml2
Stergem versiune 32bit
rpm -e libxml2-2.6.26-2.1.25.el5_11.i386