- Authenticate to vCenter to get user credential.
# curl -k -X POST https://10.0.0.27/rest/com/vmware/cis/session -u <USERNAME>@<DOMAIN>:<PASSWORD> | jq
{
"value": "SESSIONID"
}
- Save the session id to a variable
# ID=SESSIONID
# curl -k -X POST https://10.0.0.27/rest/com/vmware/cis/session -u <USERNAME>@<DOMAIN>:<PASSWORD> | jq
{
"value": "SESSIONID"
}
# ID=SESSIONID
#!/bin/bash | |
domain=$1 | |
alias=$2 | |
./letsencrypt-auto certonly -a webroot --webroot-path /var/www/vhosts/$domain/httpdocs/ -d $domain -d www.$domain -d $alias -d www.$alias --server https://acme-v01.api.letsencrypt.org/directory | |
/usr/local/psa/bin/certificate -c "$domain letsencrypt" -domain $domain -key-file /etc/letsencrypt/live/$domain/privkey.pem -cert-file /etc/letsencrypt/live/$domain/cert.pem -cacert-file /etc/letsencrypt/live/$domain/fullchain.pem | |
/usr/local/psa/bin/site -u $domain -certificate-name "$domain letsencrypt" |
## sles | |
modprobe vmw_pvscsi | |
sed -i '/^INITRD_MODULES/ s/="/="vmw_pvscsi /g' /etc/sysconfig/kernel | |
mkinitrd | |
halt | |
# change your scsi controller to paravirtual | |
## ubuntu / centos (if vmware-tools installed) | |
# simply change the controller to paravirtual |
for i in $(zgrep "postfix/smtp" mail.info* | grep "to=" | grep spamming | cut -f6 -d" " | sed 's/://g' | sort | uniq); do zgrep $i mail.info*| grep client; done |
$daysNotUsed = 7 | |
$ignoredPools = "ignoredPools" # regex are allowed here | |
Add-PSSnapIn Vmware.View.Broker | |
Add-PSSnapIn Vmware.VimAutomation.Core | |
Get-DesktopVM | ?{ $_.pool_id -notmatch $ignoredPools } | ? {$_.user_displayname} | %{ | |
$hostname = $_.hostname | |
$machineId = $_.machine_id | |
$username = $_.user_displayname.replace((Get-ADDomain).DNSRoot,(Get-ADDomain).NetBIOSName) |
apt-get install bar | |
dd if=/dev/sda | bar -s xxxM > /path/to/destiantion |
!/bin/bash | |
ymlfiles=/my/docker/compose/containers | |
backupdir=/my/backups | |
for file in $(grep -lr "image: mysql" $ymlfiles/*/*.yml) | |
do | |
pw=$(grep MYSQL_ROOT_PASSWORD $file | cut -d"=" -f2) | |
port=$(grep 3306 $file | sed -E 's/[-" ]+([0-9]+):([0-9]+)[-" ]+/\1/') | |
name=$(echo $file | cut -d'/' -f5) | |
mysqldump -hlocalhost --protocol=tcp -uroot -p$pw -P$port --all-databases > $backupdir/db-$name-$(date +%Y-%m-%d-%H-%M-%S).sql |
## you need to enable tftp under services->tftp | |
login via ssh | |
su | |
cd /usr/local/bin/ | |
mount -uw / | |
wget -O check_mk_agent "http://git.mathias-kettner.de/git/?p=check_mk.git;a=blob_plain;f=agents/check_mk_agent.freebsd;hb=HEAD" | |
chmod a+x check_mk_agent |
for i in $(ls -1 *.jpg | sed 's/ /;/g'); do | |
convert -resize 800x800 "$(echo $i | sed 's/;/ /g')" "/path/to/destiantion/$(echo $i | sed 's/;/ /g')" | |
done |