How to use PM2 to manage your scripts by themarkymark

View this thread on steempeak.com
· @themarkymark · (edited)
$34.60
How to use PM2 to manage your scripts
View this post on Hive: [How to use PM2 to manage your scripts](https://hive.blog/@themarkymark/how-to-use-pm2-to-manage-your-scripts)
👍  , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , and 239 others
👎  , , ,
properties (23)
post_id79,755,880
authorthemarkymark
permlinkhow-to-use-pm2-to-manage-your-scripts
categorylinux
json_metadata"{"app":"pruner","message":"See you on the other side!"}"
created2019-09-06 09:14:39
last_update2020-03-22 23:16:30
depth0
children14
net_rshares88,482,902,140,644
last_payout2019-09-13 09:14:39
cashout_time1969-12-31 23:59:59
total_payout_value18.969 SBD
curator_payout_value15.626 SBD
pending_payout_value0.000 SBD
promoted0.000 SBD
body_length134
author_reputation806,615,692,176,612
root_title"How to use PM2 to manage your scripts"
beneficiaries[]
max_accepted_payout1,000,000.000 SBD
percent_steem_dollars10,000
author_curate_reward""
vote details (307)
@smartsteem ·
👍
*~Smartsteem Curation Team*
properties (22)
post_id79,755,983
authorsmartsteem
permlinkpxekm9
categorylinux
json_metadata{"tags":["linux"],"app":"steemit\/0.1"}
created2019-09-06 09:20:33
last_update2019-09-06 09:20:33
depth1
children0
net_rshares0
last_payout2019-09-13 09:20:33
cashout_time1969-12-31 23:59:59
total_payout_value0.000 SBD
curator_payout_value0.000 SBD
pending_payout_value0.000 SBD
promoted0.000 SBD
body_length29
author_reputation157,680,423,525,930
root_title"How to use PM2 to manage your scripts"
beneficiaries[]
max_accepted_payout1,000,000.000 SBD
percent_steem_dollars10,000
@pemac ·
Great article compilation!

Posted using [Partiko Android](https://partiko.app/referral/pemac)
👍  ,
properties (23)
post_id79,757,153
authorpemac
permlinkpemac-re-themarkymark-how-to-use-pm2-to-manage-your-scripts-20190906t102151740z
categorylinux
json_metadata{"app":"partiko","client":"android"}
created2019-09-06 10:21:51
last_update2019-09-06 10:21:51
depth1
children0
net_rshares17,585,994,519
last_payout2019-09-13 10:21:51
cashout_time1969-12-31 23:59:59
total_payout_value0.000 SBD
curator_payout_value0.000 SBD
pending_payout_value0.000 SBD
promoted0.000 SBD
body_length94
author_reputation-410,519,067,127
root_title"How to use PM2 to manage your scripts"
beneficiaries[]
max_accepted_payout1,000,000.000 SBD
percent_steem_dollars10,000
author_curate_reward""
vote details (2)
@tenpoundsterling ·
cheers m8, thanks a lot for the commands.
👍  
properties (23)
post_id79,759,324
authortenpoundsterling
permlinkpxesge
categorylinux
json_metadata{"tags":["linux"],"app":"steemit\/0.1"}
created2019-09-06 12:09:51
last_update2019-09-06 12:09:51
depth1
children0
net_rshares11,456,651,350
last_payout2019-09-13 12:09:51
cashout_time1969-12-31 23:59:59
total_payout_value0.000 SBD
curator_payout_value0.000 SBD
pending_payout_value0.000 SBD
promoted0.000 SBD
body_length41
author_reputation1,214,631,233,212
root_title"How to use PM2 to manage your scripts"
beneficiaries[]
max_accepted_payout1,000,000.000 SBD
percent_steem_dollars10,000
author_curate_reward""
vote details (1)
@solominer · (edited)
[@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.
👍  ,
properties (23)
post_id79,761,485
authorsolominer
permlinksolominer-re-themarkymark-how-to-use-pm2-to-manage-your-scripts-20190906t133311138z
categorylinux
json_metadata{"app":"partiko","client":"android"}
created2019-09-06 13:33:12
last_update2019-09-07 14:04:03
depth1
children5
net_rshares73,276,010,130
last_payout2019-09-13 13:33:12
cashout_time1969-12-31 23:59:59
total_payout_value0.000 SBD
curator_payout_value0.000 SBD
pending_payout_value0.000 SBD
promoted0.000 SBD
body_length353
author_reputation171,132,830,416,177
root_title"How to use PM2 to manage your scripts"
beneficiaries[]
max_accepted_payout1,000,000.000 SBD
percent_steem_dollars10,000
author_curate_reward""
vote details (2)
@themarkymark ·
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.
👍  
👎  
properties (23)
post_id79,767,579
authorthemarkymark
permlinkpxf64a
categorylinux
json_metadata{"tags":["linux"],"app":"steemit\/0.1"}
created2019-09-06 17:04:57
last_update2019-09-06 17:04:57
depth2
children4
net_rshares11,522,528,284
last_payout2019-09-13 17:04:57
cashout_time1969-12-31 23:59:59
total_payout_value0.000 SBD
curator_payout_value0.000 SBD
pending_payout_value0.000 SBD
promoted0.000 SBD
body_length217
author_reputation806,615,692,176,612
root_title"How to use PM2 to manage your scripts"
beneficiaries[]
max_accepted_payout1,000,000.000 SBD
percent_steem_dollars10,000
author_curate_reward""
vote details (2)
@solominer ·
@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)
👍  ,
properties (23)
post_id79,792,177
authorsolominer
permlinksolominer-re-themarkymark-pxf64a-20190907t140541561z
categorylinux
json_metadata{"app":"partiko","client":"android"}
created2019-09-07 14:05:42
last_update2019-09-07 14:05:42
depth3
children3
net_rshares74,508,009,104
last_payout2019-09-14 14:05:42
cashout_time1969-12-31 23:59:59
total_payout_value0.000 SBD
curator_payout_value0.000 SBD
pending_payout_value0.000 SBD
promoted0.000 SBD
body_length371
author_reputation171,132,830,416,177
root_title"How to use PM2 to manage your scripts"
beneficiaries[]
max_accepted_payout1,000,000.000 SBD
percent_steem_dollars10,000
author_curate_reward""
vote details (2)
@stuffbyspencer ·
Thanks for showcasing this, I never heard of it before! Bookmarking for later use **:^)**
👍  
properties (23)
post_id79,762,158
authorstuffbyspencer
permlinkre-themarkymark-pxexjd
categorylinux
json_metadata{"tags":["linux"],"app":"steempeak\/1.15.5"}
created2019-09-06 13:59:39
last_update2019-09-06 13:59:39
depth1
children0
net_rshares11,488,431,751
last_payout2019-09-13 13:59:39
cashout_time1969-12-31 23:59:59
total_payout_value0.000 SBD
curator_payout_value0.000 SBD
pending_payout_value0.000 SBD
promoted0.000 SBD
body_length89
author_reputation12,239,897,411,079
root_title"How to use PM2 to manage your scripts"
beneficiaries[]
max_accepted_payout1,000,000.000 SBD
percent_steem_dollars10,000
author_curate_reward""
vote details (1)
@geekgirl ·
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?
👍  ,
properties (23)
post_id79,762,184
authorgeekgirl
permlinkpxexku
categorylinux
json_metadata{"tags":["linux"],"app":"steemit\/0.1"}
created2019-09-06 14:00:33
last_update2019-09-06 14:00:33
depth1
children1
net_rshares11,476,977,166
last_payout2019-09-13 14:00:33
cashout_time1969-12-31 23:59:59
total_payout_value0.000 SBD
curator_payout_value0.000 SBD
pending_payout_value0.000 SBD
promoted0.000 SBD
body_length249
author_reputation169,390,437,178,762
root_title"How to use PM2 to manage your scripts"
beneficiaries[]
max_accepted_payout1,000,000.000 SBD
percent_steem_dollars10,000
author_curate_reward""
vote details (2)
@themarkymark · (edited)
`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.
👍  
👎  
properties (23)
post_id79,767,444
authorthemarkymark
permlinkpxf5wi
categorylinux
json_metadata{"tags":["linux"],"app":"steemit\/0.1"}
created2019-09-06 17:00:24
last_update2019-09-06 17:12:45
depth2
children0
net_rshares11,465,617,884
last_payout2019-09-13 17:00:24
cashout_time1969-12-31 23:59:59
total_payout_value0.000 SBD
curator_payout_value0.000 SBD
pending_payout_value0.000 SBD
promoted0.000 SBD
body_length441
author_reputation806,615,692,176,612
root_title"How to use PM2 to manage your scripts"
beneficiaries[]
max_accepted_payout1,000,000.000 SBD
percent_steem_dollars10,000
author_curate_reward""
vote details (2)
@rishi556 ·
$0.13
It's nice and all, but I prefer the simplicity of forever for most of what I do.
👍  ,
properties (23)
post_id79,808,889
authorrishi556
permlinkpxhtdg
categorylinux
json_metadata{"tags":["linux"],"app":"steemit\/0.1"}
created2019-09-08 03:23:21
last_update2019-09-08 03:23:21
depth1
children0
net_rshares572,313,412,605
last_payout2019-09-15 03:23:21
cashout_time1969-12-31 23:59:59
total_payout_value0.067 SBD
curator_payout_value0.066 SBD
pending_payout_value0.000 SBD
promoted0.000 SBD
body_length80
author_reputation13,910,198,687,980
root_title"How to use PM2 to manage your scripts"
beneficiaries[]
max_accepted_payout1,000,000.000 SBD
percent_steem_dollars10,000
author_curate_reward""
vote details (2)
@cryptosharon ·
Ahhhhh, I could call terminal commands from the code itself to use pm2. Nice idea, thanks. That solves the api issue.
properties (22)
post_id79,954,444
authorcryptosharon
permlinkre-themarkymark-how-to-use-pm2-to-manage-your-scripts-20190912t221516030z
categorylinux
json_metadata{"community":"busy","app":"busy\/2.5.6","format":"markdown","tags":["linux"],"users":[],"links":[]}
created2019-09-12 22:15:12
last_update2019-09-12 22:15:12
depth1
children0
net_rshares0
last_payout2019-09-19 22:15:12
cashout_time1969-12-31 23:59:59
total_payout_value0.000 SBD
curator_payout_value0.000 SBD
pending_payout_value0.000 SBD
promoted0.000 SBD
body_length117
author_reputation80,455,466,172,351
root_title"How to use PM2 to manage your scripts"
beneficiaries[]
max_accepted_payout1,000,000.000 SBD
percent_steem_dollars10,000