Forever:后台运行

Express 、MongoDB 、Ghost后台运行

1.Express

使用Forever,使用npm进行安装

npm install forever -gd

运行:(由于Express4将启动方式改为了npm start,所以不能再使用 forever start app.js)

forever --help
forever start ./bin/www
forever stop ./bin/www

2.MongoDB

(需要创建/data/logs/mongodb/目录)

mongod --fork --logpath /data/logs/mongodb/mongo.log --logappend 

3.Ghost

NODE_ENV=production forever start index.js

查看运行状态:

forever list
阅读更多

Harmony Forever

06-20

Problem DescriptionnWe believe that every inhabitant of this universe eventually will find a way to live together in harmony and peace; that trust, patience, kindness and loyalty will exist between every living being of this earth; people will find a way to appreciate and cooperate with each other instead of continuous bickering, arguing and fighting. Harmony -- the stage of society so many people dream of and yet it seems so far away from now ...nnFortunately, the method of unlocking the key to true Harmony is just discovered by a group of philosophers. It is recorded on a strange meteorite which has just hit the earth. You need to decipher the true meaning behind those seemingly random symbols ... More precisely, you are to write a program which will support the following two kinds of operation on an initially empty set S :nn1.nB X : Add number X to set S . The Kth command in the form of B X always happens at time K , and number X does not belong to set S before this operation. n2.nA Y : Of all the numbers in set S currently, find the one which has the minimum remainder when divided by Y . In case a tie occurs, you should choose the one which appeared latest in the input. Report the time when this element is inserted. nnIt is said that if the answer can be given in the minimum possible time, true Harmony can be achieved by human races. You task is to write a program to help us.n nnInputnThere are multiple test cases in the input file. Each test case starts with one integer T where 1<=T<=40000 . The following T lines each describe an operation, either in the form of ``B X " or ``A Y " where 1<=X , Y<=500000 .nnT = 0 indicates the end of input file and should not be processed by your program.n nnOutputnPrint the result of each test case in the format as indicated in the sample output. For every line in the form of ``A Y ", you should output one number, the requested number, on a new line; output -1 if no such number can be found. Separate the results of two successive inputs with one single blank line.n nnSample Inputn5 nB 1 nA 5 nB 10 nA 5 nA 40 n2 nB 1 nA 2n0n nnSample OutputnCase 1: n1 n2 n1 nnCase 2: n1

没有更多推荐了,返回首页