-
Notifications
You must be signed in to change notification settings - Fork 27
Open
Description
I'm executing mgeneratejs
via cron
and receive SyntaxError: Unexpected end of JSON input
. This does not happen if I execute the script directly:
mgenerate.sh
script contents
mgeneratejs '{"name": "$name", "age": "$age", "emails": {"$array": {"of": "$email", "number": 3}}}' -n 50 | mongoimport --port 27018 -d customers -c contacts
When executed manually I get the following results and the data is successfully imported:
$ /data/UPLOAD/mgenerate.sh
2018-11-19T10:47:27.878-0500 connected to: localhost:27018
2018-11-19T10:47:28.672-0500 imported 50 documents
However when executed via cron
I see the following error in mail
and no documents are imported:
2018-11-19T10:45:01.577-0500 connected to: localhost:27018
undefined:1
SyntaxError: Unexpected end of JSON input
at Object.parse (native)
at Socket.<anonymous> (/usr/lib/node_modules/mgeneratejs/bin/mgenerate.js:94:21)
at emitNone (events.js:91:20)
at Socket.emit (events.js:185:7)
at endReadableNT (_stream_readable.js:978:12)
at _combinedTickCallback (internal/process/next_tick.js:80:11)
at process._tickCallback (internal/process/next_tick.js:104:9)
2018-11-19T10:45:02.304-0500 imported 0 documents
I've installed globally npm install -g mgeneratejs
for both my user as well as root.
While I do miss having this GREAT tool in Python:mtools, its still the best tool out there! Great work guys!
Metadata
Metadata
Assignees
Labels
No labels