Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
duniter
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container registry
Model registry
Monitor
Service Desk
Analyze
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
nodes
typescript
duniter
Commits
e5f2a3e4
Commit
e5f2a3e4
authored
9 years ago
by
Cédric Moreau
Browse files
Options
Downloads
Patches
Plain Diff
Fix
#247
ucoind now behaves as a daemon process
parent
fdca7fd1
Branches
Branches containing commit
Tags
Tags containing commit
No related merge requests found
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
package.json
+1
-0
1 addition, 0 deletions
package.json
ucoin.sh
+70
-3
70 additions, 3 deletions
ucoin.sh
with
71 additions
and
3 deletions
package.json
+
1
−
0
View file @
e5f2a3e4
...
...
@@ -48,6 +48,7 @@
"
multimeter
"
:
"
0.1.1
"
,
"
naclb
"
:
"
0.2.2
"
,
"
nat-upnp
"
:
"
https://github.com/c-geek/node-nat-upnp
"
,
"
pm2
"
:
"
0.15.10
"
,
"
q
"
:
"
1.1.2
"
,
"
q-io
"
:
"
1.13.1
"
,
"
request
"
:
"
2.31.0
"
,
...
...
This diff is collapsed.
Click to expand it.
ucoin.sh
+
70
−
3
View file @
e5f2a3e4
...
...
@@ -8,7 +8,11 @@
ucoind
()
{
NODE
=
node
local
UCOIN_DATABASE
local
UCOIN_LOG_FILE
local
UCOIN_DATA_HOME
local
NODE
local
PM2
if
[[
-d
$UCOIN_DIR
/node
]]
;
then
NODE
=
$UCOIN_DIR
/node/bin/node
...
...
@@ -17,8 +21,71 @@ ucoind() {
VERSION
=
`
$NODE
-v
`
if
[[
$VERSION
!=
v0.12
*
]]
;
then
echo
"
Node.js
v0.12 is
not available
"
;
echo
"
$NODE
v0.12 is
required
"
;
else
$NODE
--harmony
$UCOIN_DIR
/bin/ucoind
$*
# OK, execute command
PM2
=
$UCOIN_DIR
/node_modules/pm2/bin/pm2
UCOIN_DATA_HOME
=
$HOME
/.config/ucoin
case
"
$1
"
in
#---------------------------------
# UCOIN DAEMON MANAGEMENT: START
#---------------------------------
start
)
local test
local
UCOIN_LOG_FILE
local
UCOIN_ERR_FILE
UCOIN_LOG_FILE
=
$UCOIN_DATA_HOME
/
$UCOIN_DATABASE
/ucoin.log
UCOIN_ERR_FILE
=
$UCOIN_DATA_HOME
/
$UCOIN_DATABASE
/ucoin.err.log
if
[
-z
$UCOIN_DATABASE
]
;
then
UCOIN_DATABASE
=
"ucoin_default"
fi
test
=
`
$PM2
list |
grep
"
$UCOIN_DATABASE
.*online"
`
if
[
-z
"
$test
"
]
;
then
echo
$UCOIN_LOG_FILE
$PM2
start
-f
"
$UCOIN_DIR
/bin/ucoind"
--name
"
$UCOIN_DATABASE
"
--interpreter
=
"
$NODE
"
--node-args
=
"--harmony"
--log
$UCOIN_LOG_FILE
--error
$UCOIN_ERR_FILE
--merge-logs
--
start
--mdb
"
$UCOIN_DATABASE
"
--httplogs
2>/dev/null
echo
"uCoin with DB '
$UCOIN_DATABASE
' started. Use 'ucoind logs' to see interactive logs."
else
echo
1>&2
"uCoin '
$UCOIN_DATABASE
' already started."
fi
;;
#---------------------------------
# UCOIN DAEMON MANAGEMENT: STOP & OTHERS
#---------------------------------
list|info|logs|stop|restart|monit|delete
)
UCOIN_DATABASE
=
$2
if
[
-z
$UCOIN_DATABASE
]
;
then
UCOIN_DATABASE
=
"
$UCOIN_DB
"
fi
if
[
-z
$UCOIN_DATABASE
]
;
then
UCOIN_DATABASE
=
"ucoin_default"
fi
$PM2
$1
$UCOIN_DATABASE
;;
delete-all
)
$PM2
delete all
;;
#---------------------------------
# UCOIN NORMAL COMMANDS
#---------------------------------
*
)
$NODE
--harmony
"
$UCOIN_DIR
/bin/ucoind"
--mdb
"
$UCOIN_DATABASE
"
$*
;;
esac
fi
;
}
# If the script was launched with parameters, try to launch the uCoin command
if
[
!
-z
$1
]
;
then
ucoind
$*
fi
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment