Răzvan Cosma's scratchpad

random scripts of random value

Browsing Posts in Linux

Assumes ‘sudo’ is required. Net::OpenSSH::Parallel installed using cpanspec on CentOS 7

/etc/postfix/master.cf: thrttl unix – – n – – smtp -o syslog_name=smtp-throttled /etc/postfix/main.cf: thrttl_destination_rate_delay = 10s thrttl_destination_concurrency_limit = 1 thrttl_destination_recipient_limit = 2 thrttl_initial_destination_concurrency=1 transport_maps = regexp:/etc/postfix/transport /etc/postfix/transport: /\@mydomain\.com$/ thrttl:

Set up WSUS to automatically approve security patches (because it’s the right thing to do), [void][reflection.assembly]::LoadWithPartialName(“Microsoft.UpdateServices.Administration”) $wsus = Get-WSUSServer $class = $wsus.GetUpdateClassifications() | ? {$_.Title -In (‘Critical Updates’,’Security Updates’)} $rule = $wsus.GetInstallApprovalRules() | Where {$_.Name -eq “Default Automatic Approval Rule”} $class_coll = New-Object Microsoft.UpdateServices.Administration.UpdateClassificationCollection $class_coll.AddRange($class); $rule.SetUpdateClassifications($class_coll); $rule.Enabled = $True; $rule.Save() $config = $wsus.GetConfiguration(); $config.TargetingMode = […]

ESXi %pre –interpreter=busybox # extract network info from bootup VMK_INT=”vmk0″ VMK_LINE=$(localcli network ip interface ipv4 get | grep “${VMK_INT}”) IPADDR=$(echo “${VMK_LINE}” | awk ‘{print $2}’) NETMASK=$(echo “${VMK_LINE}” | awk ‘{print $3}’) GATEWAY=$(esxcfg-route | awk ‘{print $5}’) DNS=”172.16.0.1″ HOSTNAME=$(nslookup “${IPADDR}” “${DNS}” | grep Address | grep “${IPADDR}” | awk ‘{print $4}’) echo “network –bootproto=static –addvmportgroup=true –device=vmnic0 […]

1. add DAG repo 2. yum install libguestfs-tools 3. virt-filesystems –long –parts –blkdevs -h -a w2k8.img (the Windows C: is usually /dev/sda2) 4. dd if=/dev/zero of=w2k8new.img seek=20000 bs=1M count=1 5. virt-resize –expand /dev/sda2 w2k8.img w2k8new.img

While dd / partimage might work just fine, these steps detail exactly what data is where and how it got to the disk during install. Assuming old=sda new=sdb fdisk -ucl /dev/sda, create identical ones on sdb, I’ll assume just a small ext4 sdb1 for boot and LVM sdb2 that fills the disk pvdisplay && pvcreate […]

In Ubuntu: update-alternatives –list java the output should be something like There are 2 choices for the alternative java (providing /usr/bin/java). Selection    Path                       Priority   Status ———————————————————— * 0            /usr/bin/java-j2re1.6-ibm   1200      auto mode   1            /usr/bin/java-j2re1.6-ibm   1200      manual mode   2            /usr/bin/java-j2sdk1.6-ibm  1200      manual mode so JAVA_HOME is /usr/lib/j2re1.6-ibm/jre and the file to edit is $JAVA_HOME/lib/security/java.policy File syntax […]

Configure some less-used key (right win) as “compose key”. For Ubuntu/Gnome, this is in System->Preferences->Keyboard->Options. Typing RWin+a modifier then the letter will result in: rw+’: a-á e-é i-í o-ó r-ŕ s-ś z-ź w-ẃ rw+`: a-à e-è o-ò rw+<: z-ž c-č rw+key pressed twice: a-å o-° e-ə .. and a lot of others, the full list […]

mkdir /zzz mount /dev/sda3 /zzz mount -t proc none /zzz/proc mount -o bind /dev /zzz/dev chroot /zzz /bin/bash grub find /boot/grub/stage1 root (hd0,2) setup (hd0) For /boot/grub/menu.lst, a minimal config would be default Linux timeout 2 title Linux root (hd0,2) kernel=/boot/vmlinuz root=/dev/sda3 ro also check /zzz/etc/fstab.

This is a simple attempt to build an easily replaceable and cheap storage server. Cheap means a lot of SATA drives in RAID1 or 5 with both disks and controller expected to fail miserably at any time. Linux makes booting from a RAID array unnecessary difficult (even if it’s in a mirror config, c’mon Windows […]

Bad Behavior has blocked 110 access attempts in the last 7 days.