Skip to content

Instantly share code, notes, and snippets.

@ysaotome
Last active December 7, 2019 15:52
Show Gist options
  • Star 3 You must be signed in to star a gist
  • Fork 3 You must be signed in to fork a gist
  • Save ysaotome/f5a2b0e5babda027d990 to your computer and use it in GitHub Desktop.
Save ysaotome/f5a2b0e5babda027d990 to your computer and use it in GitHub Desktop.
ニフティクラウドのCLIツール( http://cloud.nifty.com/api/cli/ )を自動セットアップするスクリプトと使用例
#!/bin/bash
# setup NIFTY Cloud API Tools
(
USER=${USER}
HOME=${HOME}
ARC=$(/bin/uname -m)
## OpenJDKセットアップ
/usr/bin/yum -y install java-1.6.0-openjdk.${ARC}
## NIFTY Cloud API Tools の設定
/usr/bin/wget -P ${HOME} 'http://cloud.nifty.com/api/sdk/NIFTY_Cloud_api-tools.zip'
/usr/bin/unzip -d ${HOME} ${HOME}/NIFTY_Cloud_api-tools.zip
/bin/rm -rf ${HOME}/NIFTY_Cloud_api-tools.zip
/bin/rm -rf ${HOME}/NIFTY_Cloud_api-tools/bin/*.cmd
/bin/chown -R ${USER}:${USER} ${HOME}/NIFTY_Cloud_api-tools/
/bin/chmod 755 ${HOME}/NIFTY_Cloud_api-tools/bin/*
/bin/cat << _NCSSCONF_ >> ${HOME}/.bashrc
## NIFTY Cloud API Settings
export NIFTY_CLOUD_HOME=${HOME}/NIFTY_Cloud_api-tools/
export PATH=\${PATH}:\${NIFTY_CLOUD_HOME}/bin
export JAVA_HOME=/usr/lib/jvm/jre
export JAVA_OPTS=-Duser.language=ja 
_NCSSCONF_
source ${HOME}/.bashrc
) 2>&1 | /usr/bin/tee /var/log/niftycloud-api-tools-installer.log
@megane42
Copy link

megane42 commented Oct 3, 2017

今のバージョンだと .bashrc に下記を追記する必要がありました。

export NIFTY_CLOUD_URL=https://west-1.cp.cloud.nifty.com/api/

これをしないと org.apache.http.client.ClientProtocolException: URI does not specify a valid host name エラーが発生します。
また、URL は http://cloud.nifty.com/api/endpoint.htm を参考に、使っているリージョンと同じものを指定する必要があります。

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment