Created
March 15, 2017 01:45
-
-
Save karlroberts/141e1e7b38ca85ac3da7b88297d48a97 to your computer and use it in GitHub Desktop.
Revisions
-
karlroberts created this gist
Mar 15, 2017 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,48 @@ #!/bin/bash ##### # Launch and time python and node scripts that also launch subprocesses echo start launch python data subprocess... date "+%T %s %N" python mypydatesub.py echo echo start launch python compiled data subprocess... date "+%T %s %N" python mypydatesub.pyc echo # make sure you have installed nvm see https://github.com/creationix/nvm#install-script export NVM_DIR="$HOME/.nvm" [ -s "$NVM_DIR/nvm.sh" ] && . "$NVM_DIR/nvm.sh" # This loads nvm nvm install v7.6.0 nvm use v7.6.0 echo start launch node subprocess date "+%T %s %N" node mynodesub.js # end of launch.sh # now the python script # mypydatesub.py import subprocess subprocess.call(["date", '+%T %s %N']) subprocess.call(["date", '+%T %s %N']) # end of mypydatesub.py # also compile this to a pyc file using $ python Python 2.7.12 (default, Nov 19 2016, 06:48:10) [GCC 5.4.0 20160609] on linux2 Type "help", "copyright", "credits" or "license" for more information. >>> import py_compile >>> py_compile.compile("mypydatesub.py") >>> exit() # now the node.js script # mynodesub.js var child_process = require('child_process'); child_process.spawn('date', [ "+%T %s %N" ], { stdio: 'inherit' }); child_process.spawn('date', [ "+%T %s %N" ], { stdio: 'inherit' }); # end of mynodesub.js