#Mac#NUEiP#自動打卡#Shell Script

去年有寫一個 Laravel 專案用排程實現公司使用的打卡系統自動打卡的功能,但缺點是上下班卡的時間與 latlng 太固定,雖可以做些 Rand 微調,但可能與實際上下班時間還是有差異。

https://github.com/MTsung/nueip_auto_clock_in

於是又再寫了一隻 Shell Script 讓 Mac 在休眠與喚醒時進行打卡動作,也確保本人在公司,避免有爭議。



#Mac#Linux#Git#Shell Script

公司有許多專案,git 倉儲 (repository) 有分正式與測試機,所以每次 clone 一個專案後都需要 git remote 去新增遠端倉儲位置,避免久久一個新專案 clone 下來後忘記做這動作,寫了一隻 shell script。

Shell Script 內容


建立一個檔案 git-clone.sh

vim git-clone.sh
#!/bin/sh
git clone git@test-domain.tw:/home/web/repos/$1.git
cd $1
git remote set-url --add --push origin git@test-domain.tw:/home/web/repos/$1.git
git remote set-url --add --push origin git@prod-domain.tw:/home/web/repos/$1.git

加上執行權限

chmod +x git-clone.sh