#起動
- ログアウト後も動き続けるように nohupを付ける
- バックグラウンドで動作するようにコマンドの最後に & をつける
- 例:
nohup node app.js &
#停止
ps aux
でプロセスIDを調べるkill -9 [ProcessID]
で停止
javascript:alert('プルリクしました\n' + document.title.substr(0, document.title.indexOf(' · Pull Request')) + '\n' + location.href); |
String.prototype.replaceAll = function(before, after){ | |
return this.split(before).join(after); | |
}; |
#起動
nohup node app.js &
#停止
ps aux
でプロセスIDを調べるkill -9 [ProcessID]
で停止/* | |
実行例 | |
node gitci.js -i 10 deploy.sh | |
引数 | |
-i: interval[分] デフォルト5分 | |
最終引数: アップデートがあった場合に実行するコマンド | |
*/ | |
// 引数取得 | |
var shFile = process.argv[process.argv.length - 1]; |
#!/bin/sh | |
SERVER=$1 | |
USER=$2 | |
PASS=$3 | |
DIR=$4 | |
FILE=$5 | |
ftp -n <<END | |
open $SERVER |
/** | |
create kill process sh file. | |
Usage: | |
require('./killpmaker.js')('stop.sh'); | |
=> create stop.sh | |
*/ | |
var fs = require('fs'); | |
module.exports = function(file) { | |
fs.writeFileSync(file, 'kill -9 ' + process.pid); |
/** | |
* JSONファイルをチェックする (node.js) | |
* 使い方 | |
* - このファイルを任意の場所に置く | |
* 例: ~/jsoncheck.js | |
* - jsonファイルのパスをpipeで渡して実行する | |
* 例: $ find . -name "*.json"|node ~/jsoncheck.js | |
* - エラーがあればコンソールに表示され、exit(1)を返す。 | |
*/ | |
/* jslint node: true */ |
git checkout -- hoge.txt |
git fetch | |
current=`git log --oneline master -1` | |
origin=`git log --oneline origin/master -1` | |
if [ "$current" = "$origin" ] ; then | |
exit 0 | |
fi | |
# do something... |