自用shell备份

24 篇文章 0 订阅
12 篇文章 0 订阅

0x00 $path 设置

/etc/paths/etc/paths.d/* 中配置即可。。

#我的 /etc/paths

/usr/local/bin
/usr/bin
/bin
/usr/sbin
/sbin
/usr/local/EricShell

配置完成后,需要重启终端,然后可以

# 输出环境变量
echo $path 

0X01 wechat-plugin 安装

WeChatPlugin-MacOS : 微信小助手。

Github: https://github.com/TKkk-iOSer/WeChatPlugin-MacOS

#!/bin/zsh

# 需要 root 执行。。。。
#由于最近macOS微信频繁更新,且更新后微信小助手会失效,故写了个shell,用来安装微信插件

dldir="./WeChatPlugin-MacOS"
cd ~/Downloads

#判断是否下载过该插件,如果下载过则删除文件夹,重新下载最新版
if [ -d $dldir ]
then
    rm -rf ~/Downloads/WeChatPlugin-MacOS
fi
git clone https://github.com/TKkk-iOSer/WeChatPlugin-MacOS.git
./WeChatPlugin-MacOS/Other/Install.sh
rm -rf ~/Downloads/WeChatPlugin-MacOS

0x02 hexo-depoly

使用方式:

  • hexo-depoly # 本地部署 + Github部署
  • hexo-depoly server # 开启本地server
  • hexo-depoly local # 只在本地部署并开启本地server

千万别用root用户执行。。。。。。
万一执行了。。。。删除 public.deploy_git 再换普通用户就可以了

#!/bin/bash

cd ~/www/hexo/Droplet

if [[ $1 == "local" ]]
then
        cp _config_local.yml _config.yml
        hexo clean
        hexo g -d
        hexo d -g
        hexo server -p 8888
elif [[ $1 == "server" ]]
then
        hexo server -p 8888
else
         cp _config_all.yml _config.yml
         hexo clean
         hexo g -d
         hexo d -g
fi

此外,应特别注意:if [ $1 == "local" ] 这种写法在 $1 为空时会有问题,应使用 if [[ $1 == "local" ]]

0x03 nginx-logs-conclude nginx日志文件汇总

#!/bin/bash

# 将 nginx 日志文件按日期整理归纳

base_path='/usr/local/Cellar/nginx/1.12.2_1/logs'

#  为了兼容 macOS , 使用 `data -r` 而不是用`data -d`获取日期

day=`date -r $(expr $(date '+%s') - 86400)  +"%Y-%m-%d"`
month=`date -r $(expr $(date '+%s') - 86400)  +"%Y-%m"`

mkdir -p $base_path/$month
mv $base_path/access.log $base_path/$month/access_$day.log

kill -USR1 `cat /usr/local/Cellar/nginx/1.12.2_1/logs/nginx.pid`
  • 1
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值