Skip to content

Instantly share code, notes, and snippets.

@axipo
Created May 14, 2020 10:52
Show Gist options
  • Save axipo/81e148e47f4a02892c22e76339b68b63 to your computer and use it in GitHub Desktop.
Save axipo/81e148e47f4a02892c22e76339b68b63 to your computer and use it in GitHub Desktop.
方便用户安装mini-status的脚本,针对无nodejs相关经验的用户
#!/usr/bin/env bash
PATH=/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin:~/bin
export PATH
# install nvm
# 安装nvm
wget -qO- https://raw.githubusercontent.com/nvm-sh/nvm/v0.35.3/install.sh | bash
# load nvm
# 加载nvm
export NVM_DIR="$([ -z "${XDG_CONFIG_HOME-}" ] && printf %s "${HOME}/.nvm" || printf %s "${XDG_CONFIG_HOME}/nvm")"
[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh"
# install node js
# 安装node js
nvm install 10 --lts
# install mini-status and pm2
# 安装mini-status 和 pm2
npm install mini-status pm2 -g
# get user input
# 获取用户输入
read -p "请输入实例IP和端口(eg:1.1.1.1:8080) : " ip
read -p "请输入实例密码 : " pass
# start mini-status use pm2
# 使用pm2启动mini-status
pm2 start mini-status -- -a "${ip}" -p "${pass}"
# start mini-status on boot
# 保存为开机启动
pm2 save
pm2 startup
echo -e "请在小程序中填写接口地址:${ip}/update Password:${pass}"
# if you need https, it's suggested to use nginx to do it. It won't be covered here.
# 如果想用https,那么还是建议用nginx来反向代理一下,这里就不写了。
@skyedai910
Copy link

使用帖子中安装脚本:

wget https://gist.githubusercontent.com/axipo/81e148e47f4a02892c22e76339b68b63/raw/4ae1fc7f1ccc42ee6a4537358e41c42b415725bd/mini_status_easy_install.sh && chmod u+x mini_status_easy_install.sh && ./mini_status_easy_install

最后一步会报错:no such file or directory
脚本修改为:./mini_status_easy_install.sh成功运行

@axipo
Copy link
Author

axipo commented May 14, 2020

@skyedai910 感谢反馈,粗心了。v2ex上的附言无法修改,当时就用“大家应该能看出来”这种理由说服自己了

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