Last active
April 19, 2024 12:27
-
-
Save akillcool/40e4021f8063bae8274217d5747eb3ca to your computer and use it in GitHub Desktop.
Revisions
-
akillcool revised this gist
Feb 15, 2020 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -10,7 +10,7 @@ then /usr/bin/clash else TIME=`date '+%Y-%m-%d %H:%M:%S'` cp ${HOME}/.config/clash/config.yaml "${HOME}/.config/clash/config.yaml.bak${TIME}" curl -L -o ${HOME}/.config/clash/config.yaml ${CLASH_URL} /usr/bin/clash fi -
akillcool created this gist
Feb 14, 2020 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,14 @@ # edit and save this file to /usr/lib/systemd/system/clash.service [Unit] Description=clash After=network.target [Service] WorkingDirectory="your home directory"/.config/clash ExecStart="your home directory"/.config/clash/start-clash.sh ExecStop="your home directory"/.config/clash/stop-clash.sh Environment="HOME=your home directory" Environment="CLASH_URL=your subscribe address" [Install] WantedBy=multi-user.target This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,16 @@ #!/bin/bash # save this file to ${HOME}/.config/clash/start-clash.sh # save pid file echo $$ > ${HOME}/.config/clash/clash.pid diff ${HOME}/.config/clash/config.yaml <(curl -s ${CLASH_URL}) if [ "$?" == 0 ] then /usr/bin/clash else TIME=`date '+%Y-%m-%d %H:%M:%S'` cp ${HOME}/.config/clash/config.yaml ${HOME}/.config/clash/config.yaml.bak${TIME} curl -L -o ${HOME}/.config/clash/config.yaml ${CLASH_URL} /usr/bin/clash fi This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,7 @@ #!/bin/bash # save this file to ${HOME}/.config/clash/stop-clash.sh # read pid file PID=`cat ${HOME}/.config/clash/clash.pid` kill -9 ${PID} rm ${HOME}/.config/clash/clash.pid