Skip to content

Instantly share code, notes, and snippets.

View mungi's full-sized avatar

Mungi mungi

  • SK Holdings
  • Korea
View GitHub Profile
@mungi
mungi / global_ip.sh
Last active July 8, 2018 02:19
Setting Global IP
GIP="169.55.63.3"
cd /etc/sysconfig/network-scripts/
cp ifcfg-eth1{,:1}
sed -i 's|eth1$|eth1:1|g' ifcfg-eth1:1
sed -i "s|^IPADDR=.*|IPADDR=$GIP|g" ifcfg-eth1:1
sed -i "s|^NETMASK=.*|NETMASK=255.255.255.255|g" ifcfg-eth1:1
sed -i "/HWADDR=/d" ifcfg-eth1:1
systemctl restart network
@mungi
mungi / lssl.py
Last active June 8, 2018 03:19
List Softlayer VSIs
#!/usr/bin/env python
import SoftLayer
from prettytable import PrettyTable
client = SoftLayer.Client()
accountClient = client['SoftLayer_Account']
try:
maskval='mask[location.pathString,id,hostname,domain,maxCpu,maxMemory,primaryIpAddress,primaryBackendIpAddress,operatingSystem.passwords,activeTransaction.transactionStatus.friendlyName]'
@mungi
mungi / RHN_SUB_VIRTBUILD.sh
Created May 7, 2018 16:15
Redhat subscript at Softlayer
#!/bin/bash
# RHEL7 TESTING.
# Run with bash instead of sourcing.
# swinstall_no_source
ntpdate time.service.networklayer.com
# These will be xslt driven, using static values and integrated capsule for testing.
RHN_SATELLITE="rhnsatdal0901.service.networklayer.com"
@mungi
mungi / vmlist.py
Last active December 1, 2017 04:45
#!/usr/bin/python
import SoftLayer
from prettytable import PrettyTable
client = SoftLayer.Client()
accountClient = client['SoftLayer_Account']
''' Env. variables for credential
export SL_USERNAME=xxxxxx
export SL_API_KEY=xxxxxx
'''
@mungi
mungi / checkip.sh
Created August 4, 2017 15:04
서버에서 Public IP 얻기
curl -sL whatismyip.akamai.com
curl -sL checkip.amazonaws.com
curl -sL ipecho.net/plain
curl -sL ipinfo.io/ip
curl -sL checkip.dyndns.org/plain
curl -sL httpbin.org/ip
@mungi
mungi / slcli.sh
Last active August 24, 2017 16:21
Softlayer Command Line Interface (SLCLI) Example
# Create Virutal Server : 1core x 1GB MEM, PoD SEO01, 1Gbps NIC, CentOS 7(latest), Hourly , SSH Key
slcli vs create -H iperf2 -D sk.com -c 1 -m 1G -d seo01 -n 1000 -o CENTOS_LATEST --billing hourly --key mungi
# listing VMs
slcli vs list
@mungi
mungi / watchvsi.sh
Created August 1, 2017 09:43
Watch VSI Status
bar=""
while true; do
DASH=$(printf '=%.0s' {1..30})
echo $DASH $(date) $DASH
foo=$(slcli vs list)
DIFF=$(diff <(echo "$foo") <(echo "$bar"))
bar=$foo
if [ "$DIFF" != "" ]
then
echo $foo
@mungi
mungi / wordpress.chpw.sh
Last active July 26, 2017 06:44
이미지 생성 전 : 워드프레스 설치 후 Softlayer에서 확인 가능한 OS 비번으로 변경할 수 있는 스크립트 생성.
#!/bin/bash
cat << EOF > /root/cloudz.sh
#!/bin/sh
CONFIG_FILE="/root/provisioningConfiguration.cfg"
if [ -f "\$CONFIG_FILE" ] ; then
source \$CONFIG_FILE
INIT_ID="CloudZ"
@mungi
mungi / wordpress.sh
Last active September 29, 2021 14:11
Script to complete WordPress installation on CentOS 7
#!/bin/bash
# DB, Wordpress 초기비번 정의 /root/INIT_PASSWORD
INIT_ID="CloudZ"
INIT_PASSWORD=$(date +%s | sha256sum | base64 | head -c 10)
echo $INIT_PASSWORD > /root/INIT_PASSWORD
# 필요 패키지 설치
#yum update -y
yum install -y httpd php mariadb-server php-mysqlnd expect