rowty.net code snippets Public source code sharing repository https://rowty.net Get MAC Address of Network Interface - rowty.net code snippets cat /sys/class/net/eth0/address https://rowty.net/view/91/6/Get-MAC-Address-of-Network-Interface https://rowty.net/view/91/6/Get-MAC-Address-of-Network-Interface Mon, 20 Mar 2017 12:27:23 GMT shell script for watch functionality - rowty.net code snippets #!/bin/sh COMMAND="$@" RUN="" if [ "$COMMAND" == "" ]; then echo "No command specified. Exiting." exit fi while [ "$RUN" == "" ]; do DATE=`date` RES=`$COMMAND` clear echo "WATCH: $DATE | Press Any Key... https://rowty.net/view/90/6/shell-script-for--watch--functionality https://rowty.net/view/90/6/shell-script-for--watch--functionality Fri, 17 Mar 2017 13:45:07 GMT yum package update/info with input - rowty.net code snippets #!/bin/bash if [ $# -ne 1 ] then echo -e "\nUsage: $0 \n" echo -e "Example: $0 openssl\n\n" exit 1 fi package=$1 if yum list installed "$package" >/dev/null 2>&1 then echo "$package is installed" yum check-update... https://rowty.net/view/89/1/yum-package-update-info-with-input https://rowty.net/view/89/1/yum-package-update-info-with-input Mon, 13 Mar 2017 14:32:36 GMT Conditional shell script - rowty.net code snippets #!/bin/bash FILE="xxx.xxx.xxx.xxx:/tmp/patched.txt" if [ -f "$FILE" ]; then echo "exists" else echo "does not exist" fi https://rowty.net/view/88/1/Conditional-shell-script https://rowty.net/view/88/1/Conditional-shell-script Mon, 13 Mar 2017 14:27:19 GMT Install epel repo for CentOS 7 - rowty.net code snippets yum install epel-release https://rowty.net/view/87/1/Install-epel-repo-for-CentOS-7 https://rowty.net/view/87/1/Install-epel-repo-for-CentOS-7 Mon, 13 Mar 2017 13:53:21 GMT Linux check if SFP plugged into fiber network card - rowty.net code snippets # Not plugged in: ethtool -m eth0 Cannot get module EEPROM information: Invalid argument # Plugged in: ethtool -m eth0 Identifier : 0x03 (SFP) Extended identifier : 0x04 (GBIC/SFP defined by 2-wire interface ID) Connector : 0x07 (LC) Transceiver codes... https://rowty.net/view/86/1/Linux-check-if-SFP-plugged-into-fiber-network-card https://rowty.net/view/86/1/Linux-check-if-SFP-plugged-into-fiber-network-card Wed, 8 Mar 2017 14:41:40 GMT bash reverse-i-search ctrl r - rowty.net code snippets # ctrl-r gives you: (reverse-i-search)`': https://rowty.net/view/85/1/bash-reverse-i-search-ctrl-r https://rowty.net/view/85/1/bash-reverse-i-search-ctrl-r Fri, 3 Mar 2017 13:50:27 GMT Power on, off Dell server from idrac - rowty.net code snippets # power server off racadm serveraction powerdown # power server on racadm serveraction powerup # perform server power cycle racadm serveraction powercycle # force hard server power reset racadm serveraction hardreset # display current power status of server racadm serveraction... https://rowty.net/view/84/1/Power-on--off-Dell-server-from-idrac https://rowty.net/view/84/1/Power-on--off-Dell-server-from-idrac Fri, 3 Mar 2017 09:32:34 GMT symlink - the correct order - rowty.net code snippets # In this case, /etc/grub.conf is the symlink and needs to point to /boot/grub/grub.conf ln -s /boot/grub/grub.conf /etc/grub.conf https://rowty.net/view/83/1/symlink---the-correct-order https://rowty.net/view/83/1/symlink---the-correct-order Thu, 2 Mar 2017 14:49:06 GMT Install and set up MariaDB on CentOS 7 - rowty.net code snippets # Install MariaDB - drop-in replacement for MySQL yum install mariadb-server # Enable mariadb to start on boot systemctl enable mariadb # Start it up! systemctl start mariadb # Set a root password, remove anon users, disable root login remotely: mysql_secure_installation https://rowty.net/view/82/1/Install-and-set-up-MariaDB-on-CentOS-7 https://rowty.net/view/82/1/Install-and-set-up-MariaDB-on-CentOS-7 Thu, 2 Mar 2017 11:04:12 GMT HP P420i firmware upgrade - rowty.net code snippets # Download here: http://h20564.www2.hpe.com/hpsc/swd/public/readIndex?sp4ts.oid=5295169 https://rowty.net/view/81/1/HP-P420i-firmware-upgrade https://rowty.net/view/81/1/HP-P420i-firmware-upgrade Tue, 28 Feb 2017 12:57:01 GMT Install hpacucli on CentOS 6.8 - rowty.net code snippets # Download here: https://downloads.linux.hpe.com/SDR/repo/spp/rhel/6.8Server/x86_64/current/hpacucli-9.40-12.0.x86_64.rpm # For other versions of rhel: https://downloads.linux.hpe.com/SDR/repo/spp/rhel/ https://rowty.net/view/80/1/Install-hpacucli-on-CentOS-6.8 https://rowty.net/view/80/1/Install-hpacucli-on-CentOS-6.8 Tue, 28 Feb 2017 11:45:24 GMT Query RAID controller status using hpacucli - rowty.net code snippets hpacucli ctrl all show config detail https://rowty.net/view/79/1/Query-RAID-controller-status-using-hpacucli https://rowty.net/view/79/1/Query-RAID-controller-status-using-hpacucli Tue, 28 Feb 2017 11:23:38 GMT Install hponcfg - rowty.net code snippets # Go here and download: http://h20564.www2.hpe.com/hpsc/swd/public/detail?swItemId=MTX_0852a40470894456b684221d92 # Then install with: rpm -ivh /path/to/hponcfg-4.3.1-0.x86_64.rpm https://rowty.net/view/78/1/Install-hponcfg https://rowty.net/view/78/1/Install-hponcfg Mon, 27 Feb 2017 16:05:32 GMT Pop up a window / dialog box in osx - rowty.net code snippets osascript -e 'tell app "System Events" to display dialog "Testing"' https://rowty.net/view/77/1/Pop-up-a-window---dialog-box-in-osx https://rowty.net/view/77/1/Pop-up-a-window---dialog-box-in-osx Thu, 23 Feb 2017 12:03:43 GMT fix permissions for suphp - rowty.net code snippets find . -type d -exec chmod 755 {} \; find . -type f -name '*.php' -exec chmod 644 {} \; https://rowty.net/view/76/1/fix-permissions-for-suphp https://rowty.net/view/76/1/fix-permissions-for-suphp Thu, 23 Feb 2017 12:02:55 GMT find files owned by one user and chown them to another user - rowty.net code snippets find . -user olduser -exec chown newuser.newuser {} \; https://rowty.net/view/75/1/find-files-owned-by-one-user-and-chown-them-to-another-user https://rowty.net/view/75/1/find-files-owned-by-one-user-and-chown-them-to-another-user Thu, 23 Feb 2017 12:02:14 GMT find and replace a string in a text file - rowty.net code snippets sed -i 's/oldstring/newstring/g' file.txt https://rowty.net/view/74/1/find-and-replace-a-string-in-a-text-file https://rowty.net/view/74/1/find-and-replace-a-string-in-a-text-file Thu, 23 Feb 2017 12:01:07 GMT Clean up old kernels - rowty.net code snippets package-cleanup --oldkernels --count=2 https://rowty.net/view/73/1/Clean-up-old-kernels https://rowty.net/view/73/1/Clean-up-old-kernels Thu, 23 Feb 2017 12:00:14 GMT Create cxs quarantine directory - rowty.net code snippets cxs --qcreate --quarantine /home/quarantine https://rowty.net/view/72/1/Create-cxs-quarantine-directory https://rowty.net/view/72/1/Create-cxs-quarantine-directory Thu, 23 Feb 2017 11:59:05 GMT