Linux

Setting UPS on CentOS 8

Configure Cyber Power System, Inc. CP1500 AVR UPS in CentOS 8 Get list of USB device Connect USB cable from UPS to CentOS host and run following command lsusb UPS Vendor and Product Capture Vendor : XXXX and Product: YYYY ... Bus 003 Device 002: ID 0764:0501 Cyber Power System, Inc. CP1500 AVR UPS XXXX:YYYY ... Create udev rule For consistent naming let us create a udev rule Create or Modify /etc/udev/rules.

systemd and rc.local

How to correctly setup rc.local with systemd I have seen many blogs claiming how to setup rc.local support with system but most of those are talking about setting a new service where as systemd comes with legacy rc.local support. systemctl status rc-local Note: you do not have to enable this service, rc-local is automatically executed after network.target using systemd-rc-local-generator. Create rc.local script sudo vi /etc/rc.d/rc.local Add following text #!/bin/bash touch /tmp/rc.

QNAP UPS Sharing via network

Using QNAP Master UPS on CentOS 7 as Slave On QNAP ssh to your QNAP vi /mnt/HDA_ROOT/.config/ups/upsd.users` Add following towards the end of file. [monuser] password = monpass allowfrom = 192.168.101.101 upsmon slave Goto QNAP Web interface http://<IP Address | domain name > Navigate to : Control Panel / Externaql Devices / UPS [x] Enable network UPS master On CentOS 7 sudo yum install nut-client Edit upsmon.conf vi /etc/ups/upsmon.conf Add following line

RedHat Summit 2019

See you all at RedHat Summit 2019 in Boston, MA. Please visit Crunchy Data booth to talk about our Enterprise Support and Products offering: Crunchy Certified PostgreSQL Crunchy HA PostgreSQL Crunchy PostgreSQL for OpenShift Enterprise PostgreSQL Support Enterprise PostgreSQL Consulting

ASUS Merlin RT-AC66U Notes

1. Custom DNS goes in /jffs/configs/dnsmasq.conf.add address=/test.com/www.test.com/127.0.0.1 address=/test.com/www.test.com/::1 service restart_dnsmasq

GIT worktree

1. Fetch origin and tags git fetch --tags git fetch origin 2. Add work tree git worktree add -b <remote branch name> ../<new folder> origin/<remote branch name>

Linux ifconfig cheat sheet

Display link status & IP Addresses ifconfig Bring interface up ifconfig eth0 up Bring interface down ifconfig eth0 down Assign IP to device eth0 ifconfig eth0 192.168.0.2 Assign IP to device including netmask and broadcast ifconfig eth0 192.168.0.2 netmask 255.255.255.0 broadcast 192.168.0.1 Add IP as alias ifconfig eth0:1 192.168.1.2

Linux ip cheat sheet

Display link status ip link show Display ip addresses ip addr show Bring interface up ip link set eth0 up Bring interface down ip link set eth0 down Assign IP to device eth0 ip addr add 192.168.0.2 dev eth0 Assign IP to device including netmask and broadcast ip addr add 192.168.0.2/24 broadcast 192.168.0.255 dev eth0 Delete IP from device ip addr del 192.168.0.2/24 dev eth0 Add IP as alias ip addr add 192.

How to undo git local commit(s)

Before pushing changes if you want to change last commit(s) Soft reset git reset HEAD~ Your files are left as is, you can now modify, commit and push. Hard reset git reset --hard HEAD~ Your files will get reset to HEAD.

GIT workflow

1. Fork at github.com 2. Clone it locally git clone git@github.com:<your name>/<repo name>.git 3. Configure username and email address git config user.name 'Yogesh Sharma' git config user.email 'Yogesh.Sharma@xyz.com' 4. Add upstream git remote add upstream git@github.com:<remote name>/<repo name>`.git 5. Fetch & Merge upstream git fetch upstream git merge upstream/master 6. Commit & Push git commit git push 7. On github.com make a pull request 8. After PR is merged pull upstream and rebase git fetch upstream git rebase upstream/master git push origin master --force or

Backup freeotp

Setup android-tools on Fedora 25 Install Android tools sudo dnf install android-tools Setup udev rules sudo cp /usr/share/doc/android-tools/51-android.rules /etc/udev/rules.d/ Enable and Start adb sudo systemctl enable adb sudo systemctl start adb To backup adb backup -f ~/backup-org.fedorahosted.freeotp.adb org.fedorahosted.freeotp To Restore adb restore ~/backup-org.fedorahosted.freeotp.adb

Setup RPM Build ENV

Install required packages sudo yum install rpm-build redhat-rpm-config yum-utils Setup build environment mkdir -p ~/rpmbuild/{BUILD,RPMS,SOURCES,SPECS,SRPMS} echo '%_topdir %(echo $HOME)/rpmbuild' > ~/.rpmmacros Download src rpm and save it to ~/rpmbuild/SRPMS/ Install build dependencies for package sudo yum-builddep <package> Build package rpmbuild --rebuild <package>.src.rpm

Install ARES Wizard on Kodi

To Install Ares Wizard: Start Kodi Goto SYSTEM > File Manager Select Add Source Select None Type the following http://www.areswizard.co.uk select Done Highlight the box underneath Enter a name for this media Source, type ares and select OK Go back to your Home Screen Select SYSTEM Select Add-Ons Select Install from zip file Select ares Select script.areswizardx.x.xx.zip Wait for Add-on enabled notification The Ares Wizard is now installed and can be accessed via the PROGRAMS (or Apps) menu from your home screen

Find KVM VM’s IP from Host

Create following function in your .bash_profile FIND_VMIP() { VM=$1 IP=$(arp -e | grep $(sudo virsh domiflist ${VM} |grep vnet| awk '{print $5}') | awk '{print $1}') echo "VM ${VM} has IP ${IP}" } Create an alias alias vmip=FIND_VMIP Reload .bash_profile source ~/.bash_profile Now run command vmip to find ip. Example: $ sudo vmip myvm VM myvm has IP 192.168.122.178

Bash Shortcuts

Command Control Shortcuts Shortcut Description Ctrl + l clear the screen Ctrl + s stops the output to the screen (for long running verbose command) Ctrl + q allow output to the screen (if previously stopped using command above) Ctrl + c terminate the command Ctrl + z suspend/stop the command Command Recall Shortcuts Shortcut Description Ctrl + r search the history backwards Ctrl + g escape from history searching mode Ctrl + p previous command in history (i.

Extending PV/VG/LV on iSCSI

Extend iSCSI storage Stop LV on all nodes except one Rescan iSCSI node on one host # iscsiadm -m node -R Resize PV # pvresize /dev/<disk/part> Execute vgs and verify extended size visible as free space Extend LV # lvextend -l +100%FREE /dev/<vg>/<lv> On all other nodes run # iscsiadm -m node -R # pvscan

Fedora 22 on Raspberry Pi 2

Download one of the remix from http://arm.fedoraproject.org/ Download kernel cd /tmp/ git clone -depth 1 https://github.com/raspberrypi/firmware.git I am using LXDE: xzcat Fedora-LXDE-armhfp-22-3-sda.raw.xz | dd of=/dev/mmcblk0 bs=4M fdisk /dev/mmcblk0 change first partition type to B If you like, expand /dev/mmcblk0p3 to utilize all space and use resize2fs /dev/mmcblk0p3 to expand filesystem mkfs.vfat /dev/mmcblk0p1 mkdir /tmp/sdcard mount /dev/mmcblk0p3 /tmp/sdcard mount /dev/mmcblk0p1 /tmp/sdcard/boot cat >/tmp/sdcard/boot/config.txt #uncomment to overclock the arm. 700 MHz is the default.

openvpn certificate signature failure

CentOS and Fedora has stopped support for md5 certificates At client side if you get following error server log usually /var/log/messages VERIFY ERROR: depth=0, error=certificate signature failure: &lt;snip> TLS_ERROR: BIO read tls_read_plaintext error: error:14090086:SSL routines:SSL3_GET_SERVER_CERTIFICATE:certificate verify failed TLS Error: TLS object -> incoming plaintext read error TLS Error: TLS handshake failed Fatal TLS error (check_tls_errors_co), restarting To fix this: vi /etc/systemd/system/NetworkManager.service and add following .include /usr/lib/systemd/system/NetworkManager.service [Service] Environment="OPENSSL_ENABLE_MD5_VERIFY=1 NSS_HASH_ALG_SUPPORT=+MD5" Now restart daemon

Running multiple PostgreSQL clusters using systemd

Requirements Using systemd Multiple instance of PostgreSQL First instance running on port 5491 Second instance running on port 5492 Steps to setup first service STEP 1 create and edit service file sudo vi /etc/systemd/system/postgresql-9.4-5941.service STEP 2 Import original and Add Env .include /lib/systemd/system/postgresql-9.4.service [Service] Environment="PGDATA=/var/lib/pgsql/9.4/data1/" STEP 3 Modify postgresql.conf for instance sudo vi /var/lib/pgsql/9.4/data1/postgresql.conf" STEP 4 Change port for postgresql port=5491 Steps to setup second service STEP 1 create and edit service file

Qnap Surveillance Station Recording q264 to h264

QNAP Surveillance Station recording are marked as q264 but it is easy to change them to play with regular players Replace 4 byte at offset 0x70 and 0xBC from q264 to h264 Here is python code f=open("<Filename>.avi","r+") f.seek(0x70) f.write('h264') f.seek(0xBC) f.write('h264') f.close()

Disk benchmark with dd

Quick way to determine disk write performance dd bs=1G count=5 if=/dev/zero of=test.dat oflag=dsync status=progress Note: Try to set bs= and count= to a number which is close to double the memory to get realistic results 2 x total memory / bs = count 2 x 16 GB / 0.5 GB = count value 32 Quick way to determine disk read performance dd bs=4k if=test.dat of=/dev/null status=progress Note: Try to set bs= to sector size.

CentOS 7 Installation

For CentOS 6 users it may be difficult to understand and use new CentOS 7 installer but for Fedora users it is an easy one. To ease the life of new CentOS 7 users, here are steps for minimal CentOS 7 install. Boot from DVD Select Install CentOS 7 by pressing ↑ and press ↵ Language Selection Select your language and Click “continue” Installation Summary This is the main install setup screen.

Odoo Invoice caching

Default setting for Odoo (formerly OpenERP) is to cache invocie PDFs. To disable caching Settings -> Technical -> Actions -> Reports Scroll to Name = Invoice Select Invocie Click Edit UnCheck “Reload from Attachment” Click on Save Here is a screen shot