Look at LSB init scripts for more information.
Copy to /etc/init.d
:
# replace "$YOUR_SERVICE_NAME" with your service's name (whenever it's not enough obvious)
package main | |
import ( | |
"crypto/tls" | |
"crypto/x509" | |
"flag" | |
"io" | |
"io/ioutil" | |
"log" | |
"os" |
Look at LSB init scripts for more information.
Copy to /etc/init.d
:
# replace "$YOUR_SERVICE_NAME" with your service's name (whenever it's not enough obvious)
With Node you can write very fast JavaScript programs serverside. It's pretty easy to install Node, code your program, and run it. But > how do you make it run nicely in the background like a true server?
/etc/init/
$ sudo vim yourapp.conf
$ sudo start yourapp
$ sudo stop yourapp
sysctl -w fs.file-max=12000500 | |
sysctl -w fs.nr_open=20000500 | |
ulimit -n 4000000 | |
sysctl -w net.ipv4.tcp_mem='10000000 10000000 10000000' | |
sysctl -w net.ipv4.tcp_rmem='1024 4096 16384' | |
sysctl -w net.ipv4.tcp_wmem='1024 4096 16384' | |
sysctl -w net.core.rmem_max=16384 | |
sysctl -w net.core.wmem_max=16384 | |
wget http://packages.erlang-solutions.com/erlang-solutions_1.0_all.deb | |
sudo dpkg -i erlang-solutions_1.0_all.deb |
-module(date_util). | |
-compile(export_all). | |
epoch() -> | |
now_to_seconds(now()) | |
. | |
epoch_hires() -> | |
now_to_seconds_hires(now()) | |
. |
LOADING=false | |
usage() | |
{ | |
cat << EOF | |
usage: $0 [options] <DBNAME> | |
OPTIONS: | |
-h Show this help. | |
-l Load instead of export |
var collectionNames = db.getCollectionNames(); | |
collectionNames.forEach(function(n) { print(n + ": " + db[n].count()); }); |
namespace :grape do | |
desc 'Print compiled grape routes' | |
task :routes => :environment do | |
API.routes.each do |route| | |
puts route | |
end | |
end | |
end |
# unicorn_rails -c /data/github/current/config/unicorn.rb -E production -D | |
rails_env = ENV['RAILS_ENV'] || 'production' | |
# 16 workers and 1 master | |
worker_processes (rails_env == 'production' ? 16 : 4) | |
# Load rails+github.git into the master before forking workers | |
# for super-fast worker spawn times | |
preload_app true |