#!/bin/bash clear ./test.sh #sudo true if [ $USER = root ]; then true; else sudo -p "Enter password > " $0 $USER | red; exit 0; fi the_config_file=/usr/share/nginx/nginx.conf which spawn-fcgi > /dev/null || sudo apt-get install libfcgi-dev spawn-fcgi nginx curl echo ' events { worker_connections 1024; } http { server { listen 80; server_name localhost; location / { fastcgi_pass 127.0.0.1:8000; fastcgi_param GATEWAY_INTERFACE CGI/1.1; fastcgi_param SERVER_SOFTWARE nginx; fastcgi_param QUERY_STRING $query_string; fastcgi_param REQUEST_METHOD $request_method; fastcgi_param CONTENT_TYPE $content_type; fastcgi_param CONTENT_LENGTH $content_length; fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; fastcgi_param SCRIPT_NAME $fastcgi_script_name; fastcgi_param REQUEST_URI $request_uri; fastcgi_param DOCUMENT_URI $document_uri; fastcgi_param DOCUMENT_ROOT $document_root; fastcgi_param SERVER_PROTOCOL $server_protocol; fastcgi_param REMOTE_ADDR $remote_addr; fastcgi_param REMOTE_PORT $remote_port; fastcgi_param SERVER_ADDR $server_addr; fastcgi_param SERVER_PORT $server_port; fastcgi_param SERVER_NAME $server_name; } } } '>$the_config_file killall nginx apache2 spawn-fcgi a.out -9 &>/dev/null nginx -c $the_config_file node program.js prog '[1, [1, [2, 3]], [4, 5], [3, 4], [[2]]]' 1 'element.print()' || die g++ -O3 -static -Wall -Wextra -s all_code.cpp -lfcgi -lfcgi++ -O3 -s -Wall -Wextra # spawn the fcgi app on port 8000 with no fork spawn-fcgi -p 8000 -n a.out & sudo su -c 'google-chrome http://localhost:80 &>/dev/null &' -- $1 & #reset