watchdog/logs moment
This commit is contained in:
1
.gitignore
vendored
1
.gitignore
vendored
@@ -1,2 +1,3 @@
|
|||||||
node_modules
|
node_modules
|
||||||
token
|
token
|
||||||
|
log
|
||||||
3
readme
3
readme
@@ -1,7 +1,4 @@
|
|||||||
create token file
|
create token file
|
||||||
|
|
||||||
TODO:
|
TODO:
|
||||||
- in tmux command
|
|
||||||
- add watchdog
|
|
||||||
- output all program output to file
|
|
||||||
- add comments
|
- add comments
|
||||||
@@ -3,6 +3,7 @@
|
|||||||
"main": "index.ts",
|
"main": "index.ts",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"start": "ts-node .",
|
"start": "ts-node .",
|
||||||
"tmux": "tmux new-session -d -s $npm_package_name \"ts-node .\""
|
"watchdog": "./run.sh",
|
||||||
|
"tmux": "tmux new-session -d -s $npm_package_name \"./run.sh\""
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
31
rolemanager/run.sh
Normal file
31
rolemanager/run.sh
Normal file
@@ -0,0 +1,31 @@
|
|||||||
|
#/bin/sh
|
||||||
|
|
||||||
|
#make log folder
|
||||||
|
if [[ ! -d log ]]
|
||||||
|
then
|
||||||
|
mkdir log
|
||||||
|
fi
|
||||||
|
|
||||||
|
#current file number
|
||||||
|
num=0
|
||||||
|
if [[ -f log/number ]]
|
||||||
|
then
|
||||||
|
num=$(cat log/number)
|
||||||
|
fi
|
||||||
|
|
||||||
|
echo $num > log/number
|
||||||
|
|
||||||
|
#watchdog
|
||||||
|
while true
|
||||||
|
do
|
||||||
|
#increment log file number
|
||||||
|
num=$(( num + 1 ))
|
||||||
|
echo $num > log/number
|
||||||
|
|
||||||
|
#run
|
||||||
|
npm start >> log/$num.out 2> log/$num.err
|
||||||
|
|
||||||
|
#give chance to close program
|
||||||
|
sleep 3
|
||||||
|
echo "\n\n^C to exit\n\n"
|
||||||
|
done
|
||||||
Reference in New Issue
Block a user