 Process Manager 2 (aka PM2) is one of my favorite apps that allows me to manage my scripts. It is easy to use and extremely powerful. # What PM2 offers: * Restart scripts automatically upon failure * Restart scripts automatically upon boot * Log management * Easy Monitoring * Watch Dog Support * Cluster & Scaling Support * Cross platform * Easy to use # Why use PM2? Many people use screen & tmux to run scripts on Linux and keep them running when you exit your SSH terminal. While these are both very useful for scripts you will be watching frequently or interacting with, it is not ideal for more than one or two apps or automatically handling failures. PM2 will auto-detect if a script has quit and will automatically restart it. This is really handy for automatically handling rare exceptions and extremely powerful if your scripts are able to auto-resume. # How to install PM2 PM2 is a NodeJS application and requires NodeJS to be installed. While it was designed to manage NodeJS applications it supports Python and Ruby as well. In fact, I mostly use it to run Python scripts. You will first need to install NodeJS and I highly recommend using Node Version Manager (nvm). ### Install Node Version Manager Installing nvm is really simple, and you can see the instructions on their [Github Page](https://github.com/nvm-sh/nvm). It's is just this one line: `curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.34.0/install.sh | bash` After you install it though, you need to exit your SSH session and log back in. Finally, you need to install a version of NodeJS, you have two options here. You can install the latest version of node (my preference) or you can install the latest **Long Term Support** (lts) release. The LTS release a bit further back and considered the **production** supported release. #### Install latest NodeJS `nvm install node` `nvm use node` #### Install LTS release of NodeJS `nvm install --lts` `nvm use --lts` Regardless of your choice, you can check the version you have installed by running `node -v`. ### Install PM2 Module Installing PM2 is real easy, just run `npm install -g pm2` This will install PM2 as a global module. NodeJS modules are typically installed locally to the app you are developing, but since pm2 is a tool you use system-wide you want to have it installed globally (-g option). Once installed you can just type `pm2 ls` to see all running process. At this point, you won't have anything. You can now use PM2 to run your scripts and keep an eye on them. ### Start a script with PM2 To start a script you just need to type `pm2 start myscript.js --name myscript` If you type `pm2 ls` you will see the script running and some details about memory usage, how many restarts, the pid, and cpu usage. If you want the script to run automatically at bootup, you will need to type `pm2 save` every time you add or remove a script. This will tell PM2 to save the state of your scripts and recover that state upon reboot. You can log out of SSH at this point and your script will continue to run, will be restarted if it fails, and will automatically start upon reboots. #### Stop, restart, or remove a script There are a few commands you will want to know to manage your scripts. `pm2 stop myscript` This command will stop the script called myscript. Keep in mind, you use the name you specified with the --name argument and not the file name. `pm2 restart myscript` This will restart the script nicknamed myscript. You can also `pm2 restart all` to restart all scripts or stop them all with `pm2 stop all`. If you ever want to see the current status of your scripts, you can use `pm2 ls` or `pm2 monit`. Monit is a more detailed view and generally is used as a "tv mode" type of display. If you need to remove a script (this stops the script and no longer manages it) you can use `pm2 delete myscript`. # Logging PM2 will automatically log the output of your scripts to a file. This is one of the best features of PM2. Your quick and dirty scripts don't need to manage logging to the screen and to a log file, PM2 can do this automatically. You can view logs for your script by typing `pm2 logs myscript` or view all logs at once using `pm2 logs`. You can also look at the raw log files in `~/.pm2/logs` # Conclusion This is enough to handle 90% of the functionality you need to take advantage of PM2. PM2 can do so much more and is far more powerful than the ease of use makes it appear. If your script needs environment variables, command-line arguments, or you are having problems with Python buffering output, I recommend you check out the page on [Eco System Files](http://pm2.keymetrics.io/docs/usage/application-declaration/). https://i.imgur.com/yBNfG0R.png You can also check out the [Clustering Docs](http://pm2.keymetrics.io/docs/usage/cluster-mode/) if you plan on having it manage multiple instances and scaling of your app. There is a web interface to PM2 that shows far more detail about your applications.    There is also a paid version you can read about on https://pm2.io that has more advanced features like Machine Learning Error Detection. <sub>Images: [1](https://medium.com/tech-tajawal/process-manager-pm2-performance-optimization-part-ii-6ca8e431a578) [2](http://pm2.keymetrics.io/docs/usage/application-declaration/) [3](https://pm2.io/) [4](https://pm2.io/) [5](https://pm2.io/)</sub>
author | themarkymark |
---|---|
permlink | how-to-use-pm2-to-manage-your-scripts |
category | linux |
json_metadata | {"community":"busy","app":"busy/2.5.6","format":"markdown","tags":["linux","pm2","development","technology","busy","neoxian","palnet"],"users":[],"links":["https://github.com/nvm-sh/nvm","http://pm2.keymetrics.io/docs/usage/application-declaration/","http://pm2.keymetrics.io/docs/usage/cluster-mode/","https://pm2.io","https://medium.com/tech-tajawal/process-manager-pm2-performance-optimization-part-ii-6ca8e431a578","http://pm2.keymetrics.io/docs/usage/application-declaration/","https://pm2.io/","https://pm2.io/","https://pm2.io/"],"image":["https://ipfs.busy.org/ipfs/QmPrmnVXjv3Q1QaT2BND98QgRC2hXJeKisxUrW6oi8uDsd","https://i.imgur.com/yBNfG0R.png","https://ipfs.busy.org/ipfs/QmfLwPqsWXBivYXAMHkQBMGLshmf2wnEQowDwzL9XgAwny","https://ipfs.busy.org/ipfs/QmYqJ4VQum3KhRN4e9twibGZnzWtZE5btvjaWZuUaQ4eaU","https://ipfs.busy.org/ipfs/QmTqXxYBbXX3vLWACbh2Ax1KapWwhJsbvdJGfAYh9LNJLB"]} |
created | 2019-09-06 09:14:39 |
last_update | 2019-09-06 09:14:39 |
depth | 0 |
children | 14 |
last_payout | 2019-09-13 09:14:39 |
cashout_time | 1969-12-31 23:59:59 |
total_payout_value | 18.969 HBD |
curator_payout_value | 15.626 HBD |
pending_payout_value | 0.000 HBD |
promoted | 0.000 HBD |
body_length | 5,788 |
author_reputation | 1,778,537,525,091,126 |
root_title | "How to use PM2 to manage your scripts" |
beneficiaries | [] |
max_accepted_payout | 1,000,000.000 HBD |
percent_hbd | 10,000 |
post_id | 90,303,235 |
net_rshares | 88,482,902,140,644 |
author_curate_reward | "" |
voter | weight | wgt% | rshares | pct | time |
---|---|---|---|---|---|
bue | 0 | 1,832,220,681,594 | 100% | ||
germanaure | 0 | 7,175,809,387 | 100% | ||
cryptogee | 0 | 18,166,860,114 | 100% | ||
gerber | 0 | 21,311,048,920 | 100% | ||
hitmeasap | 0 | 32,886,549,851 | 25% | ||
inertia | 0 | 127,353,346,580 | 100% | ||
coininstant | 0 | -150,615,562,965 | -100% | ||
healthandfitness | 0 | 6,028,026,201 | 100% | ||
kdtkaren | 0 | -54,906,293,790 | -100% | ||
yoshiko | 0 | 9,417,225,969 | 1% | ||
jphamer1 | 0 | 3,264,700,920,889 | 100% | ||
stevescoins | 0 | 4,382,392,369 | 75% | ||
netaterra | 0 | 56,462,088,437 | 25% | ||
kenistyles | 0 | 138,538,698 | 11% | ||
doitvoluntarily | 0 | 4,232,437,369 | 100% | ||
discernente | 0 | 84,398,839,499 | 15% | ||
votehumanity | 0 | 266,757,682 | 100% | ||
luup | 0 | 3,687,595,173 | 100% | ||
steemyoda | 0 | 1,063,618,774,619 | 3.75% | ||
rishi556 | 0 | 16,310,950,803 | 100% | ||
techslut | 0 | 228,932,164,117 | 50% | ||
barton26 | 0 | 5,329,388,761 | 50% | ||
zorg67 | 0 | 1,261,081,145 | 100% | ||
samuelhull | 0 | 7,642,161,801 | 100% | ||
demartini | 0 | 1,916,629,314 | 100% | ||
yadamaniart | 0 | 745,622,616 | 1.39% | ||
steemcenterwiki | 0 | 1,078,503,036 | 5% | ||
playfulfoodie | 0 | 63,010,269,879 | 20% | ||
ripperone | 0 | 1,450,830,069,679 | 26% | ||
erikaflynn | 0 | 4,174,358,275 | 12% | ||
ejemai | 0 | 29,800,112,313 | 100% | ||
markkujantunen | 0 | 98,245,721,105 | 51% | ||
dyrt88 | 0 | 1,119,919,780 | 100% | ||
freebornsociety | 0 | 12,728,362,719 | 10% | ||
nicnas | 0 | 36,529,742,140 | 100% | ||
sanchezpuukko | 0 | 6,434,868,562 | 100% | ||
sepracore | 0 | 4,622,324,256 | 100% | ||
malay11 | 0 | 115,340,148 | 1.39% | ||
sacred-agent | 0 | 57,024,495,060 | 51% | ||
stackin | 0 | 81,923,818,088 | 10% | ||
tomekkk | 0 | 228,419,282 | 100% | ||
roomservice | 0 | 381,774,925,759 | 100% | ||
mys | 0 | 1,887,286,638 | 1% | ||
uplus | 0 | 2,679,443,280 | 39.47% | ||
guiltyparties | 0 | 11,076,033,146 | 3.84% | ||
lazzelazer | 0 | 7,535,629,831 | 100% | ||
necio | 0 | 656,875,527 | 100% | ||
coquiunlimited | 0 | 132,210,241 | 1.17% | ||
satoshibit | 0 | 17,891,098,242 | 100% | ||
epixar | 0 | 545,676,990 | 100% | ||
enjar | 0 | 126,901,898,873 | 100% | ||
sam99 | 0 | 5,577,361,322 | 5% | ||
paulag | 0 | 120,175,549,679 | 18.75% | ||
whd | 0 | 569,482,608 | 0.5% | ||
kayoko | 0 | 767,810,698 | 1% | ||
warfeed | 0 | 356,879,406 | 37.5% | ||
geekgirl | 0 | 23,760,001,531 | 100% | ||
edkarnie | 0 | 28,380,844,880 | 8% | ||
gokulramdas | 0 | 43,893,063,166 | 80% | ||
vibvir | 0 | 1,590,893,570 | 100% | ||
fivefiveeleven | 0 | 3,641,907,607 | 50% | ||
themarkymark | 0 | 17,761,203,535,204 | 100% | ||
dreamarif | 0 | 222,291,194 | 40% | ||
alexzicky | 0 | 35,472,076,316 | 25% | ||
msp-waves | 0 | 1,193,987,354,588 | 100% | ||
kaz2305 | 0 | 366,581,314 | 100% | ||
faustofraser | 0 | 1,495,946,924 | 81% | ||
agsttne | 0 | 4,183,339,384 | 50% | ||
openledgerio | 0 | 389,072,465 | 74% | ||
monash | 0 | 358,807,455 | 69% | ||
ffodie | 0 | 207,023,518 | 50% | ||
steemabuse | 0 | 401,514,323 | 76% | ||
kromtar | 0 | 43,440,098,139 | 18% | ||
reinhard-schmid | 0 | 117,326,549,173 | 100% | ||
buildawhale | 0 | 21,244,268,131,782 | 39.47% | ||
fersher | 0 | -157,020,118 | -100% | ||
oivas | 0 | 56,101,540,468 | 100% | ||
hairshares | 0 | 234,076,868,810 | 100% | ||
slowgrow | 0 | -383,588,022 | -100% | ||
storysharing | 0 | 14,514,507,853 | 100% | ||
yabapmatt | 0 | 4,367,988,059,327 | 100% | ||
isnochys | 0 | 9,026,393,983 | 10% | ||
gringo211985 | 0 | 3,680,639,002 | 10% | ||
qurator | 0 | 211,411,150,849 | 2.79% | ||
emdesan | 0 | 139,979,290 | 10% | ||
shahab3211 | 0 | 545,410,295 | 100% | ||
bookguy | 0 | 2,048,013,641 | 100% | ||
abbak7 | 0 | 288,564,568,302 | 100% | ||
ciuoto | 0 | 6,491,921,995 | 60% | ||
seanlloyd | 0 | 184,973,815 | 1% | ||
yulem | 0 | 3,402,271,880 | 100% | ||
smartsteem | 0 | 14,867,107,736,318 | 15% | ||
bestgift | 0 | 2,689,798,148 | 100% | ||
tute | 0 | 1,269,120,035 | 100% | ||
mytechtrail | 0 | 15,215,562,430 | 25% | ||
skycae | 0 | 212,283,736 | 1.95% | ||
cervisia | 0 | 78,956,157,392 | 45% | ||
steemusa | 0 | 5,690,350,520 | 10% | ||
howiemac | 0 | 8,596,503,275 | 100% | ||
cryptogem | 0 | 1,473,381,736 | 100% | ||
dieterhubert | 0 | 536,216,370 | 100% | ||
upmyvote | 0 | 5,291,221,057,471 | 71.82% | ||
fortunex | 0 | 3,263,371,392 | 99% | ||
voaputra | 0 | 689,913,277 | 100% | ||
amos811 | 0 | 545,482,746 | 100% | ||
doverun | 0 | 522,697,706 | 100% | ||
stuffbyspencer | 0 | 4,019,027,236 | 75% | ||
davinsh | 0 | 4,815,252,091 | 100% | ||
znnuksfe | 0 | 1,896,031,736 | 100% | ||
leslierevales | 0 | 402,387,356 | 50% | ||
portugalcoin | 0 | 18,433,593,376 | 20% | ||
steemernoob | 0 | 367,538,596 | 100% | ||
thecreativerebel | 0 | 226,523,085 | 100% | ||
vaansteam | 0 | 149,772,696,915 | 30% | ||
saqibnazir | 0 | 275,163,372 | 100% | ||
sargoon | 0 | 4,544,075,014 | 50% | ||
investfourmore | 0 | 54,508,292,947 | 20% | ||
steemflagrewards | 0 | 2,717,510,991,038 | 74.62% | ||
mondodidave73 | 0 | 354,434,952 | 15% | ||
nilfanif | 0 | 0 | 100% | ||
didic | 0 | 11,083,021,542 | 20% | ||
lovelyboo | 0 | 293,825,192 | 50% | ||
tenpoundsterling | 0 | 265,059,389 | 100% | ||
wwwfernand | 0 | 147,536,804 | 100% | ||
nwjordan | 0 | 274,805,165 | 2.09% | ||
sisygoboom | 0 | 130,422,384 | 0.1% | ||
tdogvoid | 0 | 453,558,240 | 100% | ||
tuts | 0 | 545,390,690 | 100% | ||
erarnitox | 0 | 546,808,419 | 100% | ||
ipromote | 0 | 362,604,321,086 | 100% | ||
asgarth | 0 | 1,109,906,165,142 | 100% | ||
bozz | 0 | 33,892,976,643 | 20% | ||
ashishchavda | 0 | 442,118,987 | 100% | ||
mohsen63 | 0 | 40,701,879,762 | 100% | ||
natsch | 0 | 517,268,814 | 100% | ||
satren | 0 | 15,088,323,458 | 10% | ||
sathyasankar | 0 | 146,139,935,317 | 100% | ||
spederson | 0 | 3,540,183,393 | 100% | ||
luli1 | 0 | 345,710,625 | 100% | ||
gtmatze | 0 | 2,015,122,790 | 100% | ||
adamada | 0 | 19,581,956,387 | 50% | ||
qberry | 0 | 1,340,789,936 | 1.39% | ||
jvhteach | 0 | 4,854,250,474 | 100% | ||
stmdev | 0 | 24,720,226 | 1% | ||
siddharthrout | 0 | 298,562,110 | 100% | ||
kessielynbote | 0 | 344,072,317 | 100% | ||
tadstrange | 0 | 4,107,173,074 | 100% | ||
beekerst | 0 | 2,420,035,230 | 100% | ||
mrchef111 | 0 | 98,099,398,244 | 100% | ||
blerdrage | 0 | 3,264,811,226 | 100% | ||
khayziljoy | 0 | 56,094,053 | 100% | ||
memesplease | 0 | 17,264,523,282 | 100% | ||
thethor1122 | 0 | 108,886,991 | 50% | ||
jena1997 | 0 | 867,453,106 | 50% | ||
kelvo | 0 | 159,185,111 | 35% | ||
wirednkod | 0 | 248,740,293 | 50% | ||
journeyfreedom | 0 | 2,052,132,360 | 100% | ||
rishi-sayz | 0 | 253,787,505 | 100% | ||
andreasgrubhofer | 0 | 1,230,400,305 | 1% | ||
upboater | 0 | 1,010,006,605,950 | 100% | ||
solominer | 0 | 592,976,829,047 | 100% | ||
steem.observer | 0 | 0 | 10% | ||
romeskie | 0 | 12,119,381,491 | 50% | ||
kryptogermany | 0 | 1,852,929,134 | 100% | ||
slobberchops | 0 | 1,456,568,904,493 | 100% | ||
diabonua | 0 | 19,111,699,734 | 100% | ||
abbasi1986 | 0 | 228,325,146 | 50% | ||
ntowl | 0 | 146,831,607 | 1.39% | ||
enforcer48 | 0 | 147,423,824,171 | 64% | ||
frasier | 0 | 0 | 10% | ||
rogz06 | 0 | 1,622,375,600 | 50% | ||
witnessbot | 0 | 118,647,404 | 10% | ||
commonlaw | 0 | 4,090,525,414 | 35% | ||
tutchpa | 0 | 216,198,409 | 100% | ||
cosmophobia | 0 | -50,568,688,056 | -100% | ||
baanggal | 0 | 247,874,358 | 50% | ||
wave.beads | 0 | 249,485,448 | 100% | ||
occhiblu | 0 | 479,105,158 | 65% | ||
smartmeme | 0 | 11,190,534,560 | 100% | ||
gtw | 0 | 0 | 10% | ||
kehrwoche | 0 | 143,470,387 | 10% | ||
clearbluecrypto | 0 | 21,162,383,939 | 50% | ||
apshamilton | 0 | 168,404,245,110 | 90% | ||
donnjoez | 0 | 503,277,923 | 100% | ||
lhuan874 | 0 | 203,996,173 | 50% | ||
buildaminnow | 0 | 8,000,619 | 10% | ||
bingbabe | 0 | 1,222,485,370 | 100% | ||
nasiruddin694 | 0 | 501,372,200 | 100% | ||
unmesh | 0 | 545,076,039 | 100% | ||
kostybrat | 0 | 8,530,137,825 | 20% | ||
ducnguyenbboy | 0 | 159,288,604 | 50% | ||
contco | 0 | 0 | 10% | ||
remindme.bot | 0 | 0 | 10% | ||
renulia | 0 | 546,215,716 | 100% | ||
marygourmet | 0 | 487,015,738 | 100% | ||
witnessupdate | 0 | 27,214,133,348 | 100% | ||
yestermorrow | 0 | 8,514,651,299 | 31% | ||
hamismsf | 0 | 131,827,459,265 | 25% | ||
meow99 | 0 | 12,450,534,111 | 100% | ||
anttn | 0 | 35,607,470,871 | 15% | ||
dronegraphica | 0 | 342,365,061 | 1.39% | ||
ngoikhoctrencay | 0 | 247,347,691 | 50% | ||
laviem | 0 | 102,843,497 | 50% | ||
allcultures | 0 | 530,334,809 | 100% | ||
youngu | 0 | 147,200,820 | 50% | ||
luckyy | 0 | 91,585,453 | 50% | ||
ntn-vlogs | 0 | 150,309,630 | 50% | ||
lupafilotaxia | 0 | 16,620,337,591 | 50% | ||
alaiza | 0 | 226,336,180 | 50% | ||
definethedollar | 0 | 78,411,627,994 | 25% | ||
spielekiste | 0 | 511,216,956 | 100% | ||
laissez-faire | 0 | 110,081,048 | 100% | ||
jacekw.dev | 0 | 3,591,517,757 | 100% | ||
lapp | 0 | 227,347,829 | 50% | ||
steemtpistia | 0 | 227,069,461 | 50% | ||
crassipes | 0 | 227,201,081 | 50% | ||
rgirgin | 0 | 400,521,856 | 100% | ||
duyduc | 0 | 217,219,272 | 50% | ||
amusdnom | 0 | 18,434,027,668 | 100% | ||
sumantakumar | 0 | 545,541,269 | 100% | ||
agrovision | 0 | 227,347,812 | 50% | ||
zeronight | 0 | 248,742,542 | 50% | ||
thanhnga1999 | 0 | 247,675,684 | 50% | ||
the4thmusketeer | 0 | 60,388,058,471 | 95% | ||
gungunkrishu | 0 | 115,547,560,272 | 100% | ||
brianoflondon | 0 | 41,398,435,845 | 25% | ||
deadpresidents | 0 | 538,811,082 | 100% | ||
steempope | 0 | 448,477,208 | 70% | ||
steemelements | 0 | 0 | 10% | ||
terminator01 | 0 | 195,665,851 | 100% | ||
joelpugapt | 0 | 1,508,171,226 | 100% | ||
cwow2 | 0 | 49,844,785,439 | 25% | ||
mistia | 0 | 5,744,977,948 | 100% | ||
missaj | 0 | 618,396,964 | 14% | ||
themightysquid | 0 | 7,232,823,732 | 100% | ||
popcornexpress | 0 | 52,975,175,558 | 100% | ||
tamito0201 | 0 | 309,927,833 | 1% | ||
dismayedworld | 0 | 532,988,989 | 100% | ||
jpbliberty | 0 | 130,511,251,809 | 25% | ||
fural | 0 | 847,539,660 | 100% | ||
layneebug | 0 | 172,397,205 | 25% | ||
yuriy4 | 0 | 394,894,323 | 14% | ||
bluerobo | 0 | 25,312,619,549 | 100% | ||
tigerrkg | 0 | 24,845,693,332 | 100% | ||
bilderkiste | 0 | 936,490,796 | 100% | ||
flodor | 0 | 174,821,533 | 10% | ||
ajks | 0 | 58,535,152,129 | 100% | ||
chrisho | 0 | 543,294,008 | 100% | ||
i-c-e | 0 | 1,491,561,326 | 35% | ||
grand.strategy | 0 | 311,113,467 | 10% | ||
smon-joa | 0 | 43,502,899,766 | 100% | ||
broxi | 0 | 5,194,784,642 | 75% | ||
fjjrg | 0 | 627,174,505 | 100% | ||
hamsa.quality | 0 | 566,965,713 | 7% | ||
felixpower | 0 | 254,466,519 | 10% | ||
sternekoechin | 0 | 69,666,373 | 10% | ||
vintageprint | 0 | 153,640,481 | 50% | ||
cpt-sparrow | 0 | 2,884,473,331 | 100% | ||
jackramsey | 0 | 715,915,987 | 2.37% | ||
cihangecgel | 0 | 479,425,676 | 100% | ||
szf | 0 | 672,474,030 | 50% | ||
anti-fraud | 0 | 10,311,877,888 | 10% | ||
memehub | 0 | 2,567,511,483,129 | 100% | ||
coredump | 0 | 87,185,696 | 10% | ||
epicdice | 0 | 1,397,248,905,445 | 100% | ||
render-obsolete | 0 | 20,675,387,846 | 100% | ||
rollingbones | 0 | 65,691,674,739 | 100% | ||
never-giveup | 0 | 94,679,336 | 25% | ||
deeanndmathews | 0 | 144,629,650 | 1.39% | ||
ritch | 0 | 19,119,880,908 | 50% | ||
banvie | 0 | 33,851,510,498 | 100% | ||
onespringday | 0 | 724,034,077 | 10% | ||
abojasim880 | 0 | 3,724,179 | 100% | ||
tr3nches | 0 | 2,032,833,344 | 100% | ||
myotherstuff | 0 | 4,860,390,464 | 18.75% | ||
volingy9 | 0 | 183,928,161 | 100% | ||
mhmohammad | 0 | 177,809,768 | 100% | ||
helcim | 0 | 3,753,018,948 | 100% | ||
diceshark | 0 | 0 | 1.25% | ||
todociencia | 0 | 830,722,518 | 50% | ||
fasolo97 | 0 | 263,632,305 | 100% | ||
astil.codex | 0 | 373,274,091 | 70% | ||
vxc | 0 | 2,272,049,245 | 100% | ||
lookplz | 0 | 2,347,164,646 | 12% | ||
r-pal | 0 | 188,783,042 | 40% | ||
debnathtuhin | 0 | 535,095,669 | 100% | ||
palvoter | 0 | 492,630,632 | 100% | ||
ilias.fragment | 0 | 342,178,928 | 70% | ||
hyborian-strain | 0 | 1,818,403,792 | 30% | ||
zaku-pal | 0 | 188,928,430 | 40% | ||
partitura.stem | 0 | 443,070,384 | 100% | ||
nomsinc | 0 | 120,097,419 | 25% | ||
geohagasconjr | 0 | 443,906,435 | 50% | ||
abh12345.stem | 0 | 959,830,858 | 100% | ||
abh12345.neox | 0 | 0 | 5.09% | ||
yebe | 0 | 2,186,012,995 | 55% | ||
sasifuddin | 0 | 449,961,725 | 100% | ||
slobberchops.tri | 0 | 932,986,541 | 100% | ||
archytas.replica | 0 | 354,658,577 | 70% | ||
anggreklesta.alt | 0 | 239,033,549 | 100% | ||
pemac | 0 | 258,684,264 | 5% | ||
organduo.pal | 0 | 0 | 2.79% | ||
laputis.pal | 0 | 0 | 2.79% | ||
mk-stem-token | 0 | 3,917,634,956 | 100% | ||
steem-aide | 0 | 9,083,127,545 | 15% | ||
vxc.stem | 0 | 38,286,823 | 100% | ||
bruneo | 0 | 278,966,715 | 100% | ||
natacha19 | 0 | 78,397,384 | 100% |
Ahhhhh, I could call terminal commands from the code itself to use pm2. Nice idea, thanks. That solves the api issue.
author | cryptosharon |
---|---|
permlink | re-themarkymark-how-to-use-pm2-to-manage-your-scripts-20190912t221516030z |
category | linux |
json_metadata | {"community":"busy","app":"busy/2.5.6","format":"markdown","tags":["linux"],"users":[],"links":[],"image":[]} |
created | 2019-09-12 22:15:12 |
last_update | 2019-09-12 22:15:12 |
depth | 1 |
children | 0 |
last_payout | 2019-09-19 22:15:12 |
cashout_time | 1969-12-31 23:59:59 |
total_payout_value | 0.000 HBD |
curator_payout_value | 0.000 HBD |
pending_payout_value | 0.000 HBD |
promoted | 0.000 HBD |
body_length | 117 |
author_reputation | 91,921,317,551,639 |
root_title | "How to use PM2 to manage your scripts" |
beneficiaries | [] |
max_accepted_payout | 1,000,000.000 HBD |
percent_hbd | 10,000 |
post_id | 90,521,221 |
net_rshares | 0 |
I was using tmux. PM2 looks like this is a better solution for me since my scripts tend to fail a lot. I really like the auto-restart feature. Just to clarify, does `pm2 save`work as an auto-restart when script stops working due to various errors?
author | geekgirl |
---|---|
permlink | pxexku |
category | linux |
json_metadata | {"tags":["linux"],"app":"steemit/0.1"} |
created | 2019-09-06 14:00:33 |
last_update | 2019-09-06 14:00:33 |
depth | 1 |
children | 1 |
last_payout | 2019-09-13 14:00:33 |
cashout_time | 1969-12-31 23:59:59 |
total_payout_value | 0.000 HBD |
curator_payout_value | 0.000 HBD |
pending_payout_value | 0.000 HBD |
promoted | 0.000 HBD |
body_length | 249 |
author_reputation | 1,588,017,852,468,897 |
root_title | "How to use PM2 to manage your scripts" |
beneficiaries | [] |
max_accepted_payout | 1,000,000.000 HBD |
percent_hbd | 10,000 |
post_id | 90,310,148 |
net_rshares | 11,476,977,166 |
author_curate_reward | "" |
voter | weight | wgt% | rshares | pct | time |
---|---|---|---|---|---|
shammi | 0 | 0 | 2% | ||
enforcer48 | 0 | 11,476,977,166 | 5% |
`pm2 save` saves the current state of your scripts. You might have some scripts handled under pm2 but stopped and some running. It will keep track of that for you and upon reboot, they will be in the same state. `pm2 save` has nothing to do with auto-restart, that will happen automatically after doing a `pm2 start` I use tmux a lot as well for single processes. It's a shame it isn't as easy to log as screen but I like it far better.
author | themarkymark |
---|---|
permlink | pxf5wi |
category | linux |
json_metadata | {"tags":["linux"],"app":"steemit/0.1"} |
created | 2019-09-06 17:00:24 |
last_update | 2019-09-06 17:12:45 |
depth | 2 |
children | 0 |
last_payout | 2019-09-13 17:00:24 |
cashout_time | 1969-12-31 23:59:59 |
total_payout_value | 0.000 HBD |
curator_payout_value | 0.000 HBD |
pending_payout_value | 0.000 HBD |
promoted | 0.000 HBD |
body_length | 441 |
author_reputation | 1,778,537,525,091,126 |
root_title | "How to use PM2 to manage your scripts" |
beneficiaries | [] |
max_accepted_payout | 1,000,000.000 HBD |
percent_hbd | 10,000 |
post_id | 90,315,892 |
net_rshares | 11,465,617,884 |
author_curate_reward | "" |
voter | weight | wgt% | rshares | pct | time |
---|---|---|---|---|---|
supera244 | 0 | 0 | -100% | ||
enforcer48 | 0 | 11,465,617,884 | 5% |
Great article compilation! Posted using [Partiko Android](https://partiko.app/referral/pemac)
author | pemac |
---|---|
permlink | pemac-re-themarkymark-how-to-use-pm2-to-manage-your-scripts-20190906t102151740z |
category | linux |
json_metadata | {"app":"partiko","client":"android"} |
created | 2019-09-06 10:21:51 |
last_update | 2019-09-06 10:21:51 |
depth | 1 |
children | 0 |
last_payout | 2019-09-13 10:21:51 |
cashout_time | 1969-12-31 23:59:59 |
total_payout_value | 0.000 HBD |
curator_payout_value | 0.000 HBD |
pending_payout_value | 0.000 HBD |
promoted | 0.000 HBD |
body_length | 94 |
author_reputation | -410,581,125,284 |
root_title | "How to use PM2 to manage your scripts" |
beneficiaries | [] |
max_accepted_payout | 1,000,000.000 HBD |
percent_hbd | 10,000 |
post_id | 90,304,628 |
net_rshares | 17,585,994,519 |
author_curate_reward | "" |
voter | weight | wgt% | rshares | pct | time |
---|---|---|---|---|---|
enforcer48 | 0 | 11,468,001,740 | 5% | ||
pemac | 0 | 6,117,992,779 | 100% |
It's nice and all, but I prefer the simplicity of forever for most of what I do.
author | rishi556 |
---|---|
permlink | pxhtdg |
category | linux |
json_metadata | {"tags":["linux"],"app":"steemit/0.1"} |
created | 2019-09-08 03:23:21 |
last_update | 2019-09-08 03:23:21 |
depth | 1 |
children | 0 |
last_payout | 2019-09-15 03:23:21 |
cashout_time | 1969-12-31 23:59:59 |
total_payout_value | 0.067 HBD |
curator_payout_value | 0.066 HBD |
pending_payout_value | 0.000 HBD |
promoted | 0.000 HBD |
body_length | 80 |
author_reputation | 132,878,102,797,039 |
root_title | "How to use PM2 to manage your scripts" |
beneficiaries | [] |
max_accepted_payout | 1,000,000.000 HBD |
percent_hbd | 10,000 |
post_id | 90,361,279 |
net_rshares | 572,313,412,605 |
author_curate_reward | "" |
voter | weight | wgt% | rshares | pct | time |
---|---|---|---|---|---|
sbi3 | 0 | 560,768,040,395 | 64.94% | ||
enforcer48 | 0 | 11,545,372,210 | 5% |
👍 *~Smartsteem Curation Team*
author | smartsteem |
---|---|
permlink | pxekm9 |
category | linux |
json_metadata | {"tags":["linux"],"app":"steemit/0.1"} |
created | 2019-09-06 09:20:33 |
last_update | 2019-09-06 09:20:33 |
depth | 1 |
children | 0 |
last_payout | 2019-09-13 09:20:33 |
cashout_time | 1969-12-31 23:59:59 |
total_payout_value | 0.000 HBD |
curator_payout_value | 0.000 HBD |
pending_payout_value | 0.000 HBD |
promoted | 0.000 HBD |
body_length | 29 |
author_reputation | 157,838,860,587,218 |
root_title | "How to use PM2 to manage your scripts" |
beneficiaries | [] |
max_accepted_payout | 1,000,000.000 HBD |
percent_hbd | 10,000 |
post_id | 90,303,358 |
net_rshares | 0 |
[@themarkymark](https://steemit.com/@themarkymark) I love pm2. I use it on my Spee.ch server and my onelovedtube server. Recently I started using the "cron_restart" command in pm2 for restarting my leaky apps once a day so they dont run out of memory. It was introduced into pm2 a few versions ago. Great app, glad to see it's used by yourself as well.
author | solominer |
---|---|
permlink | solominer-re-themarkymark-how-to-use-pm2-to-manage-your-scripts-20190906t133311138z |
category | linux |
json_metadata | {"app":"partiko","client":"android"} |
created | 2019-09-06 13:33:12 |
last_update | 2019-09-07 14:04:03 |
depth | 1 |
children | 5 |
last_payout | 2019-09-13 13:33:12 |
cashout_time | 1969-12-31 23:59:59 |
total_payout_value | 0.000 HBD |
curator_payout_value | 0.000 HBD |
pending_payout_value | 0.000 HBD |
promoted | 0.000 HBD |
body_length | 353 |
author_reputation | 1,852,540,963,779,510 |
root_title | "How to use PM2 to manage your scripts" |
beneficiaries | [] |
max_accepted_payout | 1,000,000.000 HBD |
percent_hbd | 10,000 |
post_id | 90,309,345 |
net_rshares | 73,276,010,130 |
author_curate_reward | "" |
voter | weight | wgt% | rshares | pct | time |
---|---|---|---|---|---|
enforcer48 | 0 | 11,533,944,533 | 5% | ||
makingblocks | 0 | 61,742,065,597 | 100% |
pm2 is deceptively easy to use but has so many features you would never expect. A real shame there it is so expensive to use the paid version. For $80/months should be unlimited processes or a lot more than just 24.
author | themarkymark |
---|---|
permlink | pxf64a |
category | linux |
json_metadata | {"tags":["linux"],"app":"steemit/0.1"} |
created | 2019-09-06 17:04:57 |
last_update | 2019-09-06 17:04:57 |
depth | 2 |
children | 4 |
last_payout | 2019-09-13 17:04:57 |
cashout_time | 1969-12-31 23:59:59 |
total_payout_value | 0.000 HBD |
curator_payout_value | 0.000 HBD |
pending_payout_value | 0.000 HBD |
promoted | 0.000 HBD |
body_length | 217 |
author_reputation | 1,778,537,525,091,126 |
root_title | "How to use PM2 to manage your scripts" |
beneficiaries | [] |
max_accepted_payout | 1,000,000.000 HBD |
percent_hbd | 10,000 |
post_id | 90,316,036 |
net_rshares | 11,522,528,284 |
author_curate_reward | "" |
voter | weight | wgt% | rshares | pct | time |
---|---|---|---|---|---|
supera244 | 0 | 0 | -100% | ||
enforcer48 | 0 | 11,522,528,284 | 5% |
@themarkymark oh.. I was wondering what you got with the paid version. My servers are quite light weight and I have a max of three or four pm2 processes running. But by the looks of your screenshots you may be close to that limit. Yeah seems kinda crappy of them to do that, in the linux community. Posted using [Partiko Android](https://partiko.app/referral/solominer)
author | solominer |
---|---|
permlink | solominer-re-themarkymark-pxf64a-20190907t140541561z |
category | linux |
json_metadata | {"app":"partiko","client":"android"} |
created | 2019-09-07 14:05:42 |
last_update | 2019-09-07 14:05:42 |
depth | 3 |
children | 3 |
last_payout | 2019-09-14 14:05:42 |
cashout_time | 1969-12-31 23:59:59 |
total_payout_value | 0.000 HBD |
curator_payout_value | 0.000 HBD |
pending_payout_value | 0.000 HBD |
promoted | 0.000 HBD |
body_length | 371 |
author_reputation | 1,852,540,963,779,510 |
root_title | "How to use PM2 to manage your scripts" |
beneficiaries | [] |
max_accepted_payout | 1,000,000.000 HBD |
percent_hbd | 10,000 |
post_id | 90,342,980 |
net_rshares | 74,508,009,104 |
author_curate_reward | "" |
voter | weight | wgt% | rshares | pct | time |
---|---|---|---|---|---|
enforcer48 | 0 | 11,511,123,450 | 5% | ||
makingblocks | 0 | 62,996,885,654 | 100% |
Thanks for showcasing this, I never heard of it before! Bookmarking for later use **:^)**
author | stuffbyspencer |
---|---|
permlink | re-themarkymark-pxexjd |
category | linux |
json_metadata | {"tags":["linux"],"app":"steempeak/1.15.5"} |
created | 2019-09-06 13:59:39 |
last_update | 2019-09-06 13:59:39 |
depth | 1 |
children | 0 |
last_payout | 2019-09-13 13:59:39 |
cashout_time | 1969-12-31 23:59:59 |
total_payout_value | 0.000 HBD |
curator_payout_value | 0.000 HBD |
pending_payout_value | 0.000 HBD |
promoted | 0.000 HBD |
body_length | 89 |
author_reputation | 13,003,870,677,623 |
root_title | "How to use PM2 to manage your scripts" |
beneficiaries | [] |
max_accepted_payout | 1,000,000.000 HBD |
percent_hbd | 10,000 |
post_id | 90,310,122 |
net_rshares | 11,488,431,751 |
author_curate_reward | "" |
voter | weight | wgt% | rshares | pct | time |
---|---|---|---|---|---|
enforcer48 | 0 | 11,488,431,751 | 5% |
cheers m8, thanks a lot for the commands.
author | tenpoundsterling |
---|---|
permlink | pxesge |
category | linux |
json_metadata | {"tags":["linux"],"app":"steemit/0.1"} |
created | 2019-09-06 12:09:51 |
last_update | 2019-09-06 12:09:51 |
depth | 1 |
children | 0 |
last_payout | 2019-09-13 12:09:51 |
cashout_time | 1969-12-31 23:59:59 |
total_payout_value | 0.000 HBD |
curator_payout_value | 0.000 HBD |
pending_payout_value | 0.000 HBD |
promoted | 0.000 HBD |
body_length | 41 |
author_reputation | 1,358,739,946,174 |
root_title | "How to use PM2 to manage your scripts" |
beneficiaries | [] |
max_accepted_payout | 1,000,000.000 HBD |
percent_hbd | 10,000 |
post_id | 90,306,996 |
net_rshares | 11,456,651,350 |
author_curate_reward | "" |
voter | weight | wgt% | rshares | pct | time |
---|---|---|---|---|---|
enforcer48 | 0 | 11,456,651,350 | 5% |