arangodb - Can arangosh support shebang with --javascript.execute -


arangosh seems not having shebangs in javascript files loaded --javascript.execute

i'm making sysadmin tools our arangodb - tools guy root password use when stuff breaks! tools wont ask permission, bypass arangodb's permission restrictions. use unix socket that.

so far have made /opt/arango-tools/bin/arangojs with:

#!/bin/bash soc=/var/lib/arangodb/unrestricted-endpoint if [ -r $soc ] && [ -w $soc ]   /usr/bin/arangosh --server.endpoint unix://$soc --javascript.execute "$@" else   echo needs r/w $soc, consider running sudo    exit 1 fi 

and simple helper tool /opt/arango-tools/bin/list-users.js with:

#!/opt/arango-tools/bin/arangojs var users = require("org/arangodb/users"); db._listdatabases().foreach(function(db_name) {   console.log(db_name);   db._usedatabase(db_name);   users.all().foreach(function(row) {     console.log("  " + row.user +        (row.active ? ' (active)':' (disabled)'));   }); }); 

but when running goes like:

mogul@guldager:~$ sudo /opt/arango-tools/bin/list-arangodb.js 2016-03-17t08:46:46z [11876] error javascript exception in file '/opt/arango-tools/bin/list-arangodb.js' @ 1,1: syntaxerror: unexpected token illegal 2016-03-17t08:46:46z [11876] error !#!/opt/arango-tools/bin/arangojs 2016-03-17t08:46:46z [11876] error !^ mogul@guldager:~$  

obviously line starting #! not valid javascript.

suggestions / workarounds / ideas - anyone?

its not possible.

however, liked idea, , arangodb 2.8.6 onwarnds able this:

#!/usr/bin/arangosh --javascript.execute  print('hello world') 

it shure source regular environment can that

/usr/bin/arangosh --javascript.execute /tmp/test.js 

could before.


Comments

Popular posts from this blog

java - Run spring boot application error: Cannot instantiate interface org.springframework.context.ApplicationListener -

reactjs - React router and this.props.children - how to pass state to this.props.children -

Excel VBA "Microsoft Windows Common Controls 6.0 (SP6)" Location Changes -