Page tree
Skip to end of metadata
Go to start of metadata


 Start, stop, restart, monitor the xCally Motion service


The xCally Motion service is managed by pm2 service manager for node.js

The main useful commands are:


 

pm2 list

 pm2 list
┌──────────┬────┬──────┬───────┬────────┬─────────┬────────┬──────────────┬──────────┐
│ App name │ id │ mode │ pid   │ status │ restart │ uptime │ memory       │ watching │
├──────────┼────┼──────┼───────┼────────┼─────────┼────────┼──────────────┼──────────┤
│ motion   │ 0  │ fork │ 24618 │ online │ 10      │ 21m    │ 199.730 MB   │ disabled │
└──────────┴────┴──────┴───────┴────────┴─────────┴────────┴──────────────┴──────────┘
 Use `pm2 show <id|name>` to get more details about an app

 

pm2 show motion

[[email protected] ~]# pm2 show motion
Describing process with id 0 - name motion
┌───────────────────┬──────────────────────────────────┐
│ status            │ online                           │
│ name              │ motion                           │
│ node.js version   │ 5.9.0                            │
│ id                │ 0                                │
│ path              │ /var/opt/motion/server/app.js    │
│ args              │ N/A                              │
│ exec cwd          │ /var/opt/motion/server           │
│ error log path    │ /var/log/xcally/motion-err-0.log │
│ out log path      │ /var/log/xcally/motion-out-0.log │
│ pid path          │ /root/.pm2/pids/motion-0.pid     │
│ mode              │ fork_mode                        │
│ node v8 arguments │ N/A                              │
│ watch & reload    │ ✘                                │
│ interpreter       │ node                             │
│ restarts          │ 10                               │
│ unstable restarts │ 0                                │
│ uptime            │ 25m                              │
│ created at        │ 2016-04-12T08:10:17.088Z         │
└───────────────────┴──────────────────────────────────┘
Process configuration
Probes value
┌────────────┬─────────┐
│ Loop delay │ 14.17ms │
└────────────┴─────────┘

 

pm2 monit

⌬ PM2 monitoring (To go further check out https://app.keymetrics.io)
 ● motion                              [                              ] 0 %
[0] [fork_mode]                        [||||||||||||||||              ] 201.844 MB

 

pm2 start|stop|restart|reload motion

**START SERVICE**
[[email protected] ~]# pm2 start motion
[PM2] restartProcessId process id 0
[PM2] Process successfully started
┌──────────┬────┬──────┬───────┬────────┬─────────┬────────┬─────────────┬──────────┐
│ App name │ id │ mode │ pid   │ status │ restart │ uptime │ memory      │ watching │
├──────────┼────┼──────┼───────┼────────┼─────────┼────────┼─────────────┼──────────┤
│ motion   │ 0  │ fork │ 24776 │ online │ 11      │ 0s     │ 11.074 MB   │ disabled │
└──────────┴────┴──────┴───────┴────────┴─────────┴────────┴─────────────┴──────────┘
 Use `pm2 show <id|name>` to get more details about an app

**STOP SERVICE**
[[email protected] ~]# pm2 stop motion
[PM2] Stopping motion
[PM2] stopProcessId process id 0
┌──────────┬────┬──────┬─────┬─────────┬─────────┬────────┬────────┬──────────┐
│ App name │ id │ mode │ pid │ status  │ restart │ uptime │ memory │ watching │
├──────────┼────┼──────┼─────┼─────────┼─────────┼────────┼────────┼──────────┤
│ motion   │ 0  │ fork │ 0   │ stopped │ 11      │ 0      │ 0 B    │ disabled │
└──────────┴────┴──────┴─────┴─────────┴─────────┴────────┴────────┴──────────┘
 Use `pm2 show <id|name>` to get more details about an app
 
**RESTART SERVICE**
[[email protected] ~]# pm2 restart motion
[PM2] restartProcessId process id 0
┌──────────┬────┬──────┬───────┬────────┬─────────┬────────┬─────────────┬──────────┐
│ App name │ id │ mode │ pid   │ status │ restart │ uptime │ memory      │ watching │
├──────────┼────┼──────┼───────┼────────┼─────────┼────────┼─────────────┼──────────┤
│ motion   │ 0  │ fork │ 24799 │ online │ 11      │ 0s     │ 11.094 MB   │ disabled │
└──────────┴────┴──────┴───────┴────────┴─────────┴────────┴─────────────┴──────────┘
 Use `pm2 show <id|name>` to get more details about an app
 
**RELOAD SERVICE**
[[email protected] ~]# pm2 reload /var/opt/motion/server/app.json
[PM2] reloadProcessId process id 0
┌──────────┬────┬──────┬───────┬────────┬─────────┬────────┬─────────────┬──────────┐
│ App name │ id │ mode │ pid   │ status │ restart │ uptime │ memory      │ watching │
├──────────┼────┼──────┼───────┼────────┼─────────┼────────┼─────────────┼──────────┤
│ motion   │ 0  │ fork │ 24799 │ online │ 11      │ 0s     │ 11.094 MB   │ disabled │
└──────────┴────┴──────┴───────┴────────┴─────────┴────────┴─────────────┴──────────┘
 Use `pm2 show <id|name>` to get more details about an app

Also available the commands:

service motion start|stop|restart

 

pm2 logs

[[email protected] ~]# pm2 logs
[PM2] Tailing last 20 lines for [all] processes
PM2: 2016-04-08 12:46:04: Starting execution sequence in -fork mode- for app name:motion id:0
PM2: 2016-04-08 12:46:04: App name:motion id:0 online
PM2: 2016-04-11 10:35:08: Stopping app:motion id:0
PM2: 2016-04-11 10:35:08: Process with pid 5324 still not killed, retrying...
PM2: 2016-04-11 10:35:08: Process with pid 5324 still not killed, retrying...
PM2: 2016-04-11 10:35:08: App [motion] with id [0] and pid [5324], exited with code [0] via signal [null]
PM2: 2016-04-11 10:35:08: Starting execution sequence in -fork mode- for app name:motion id:0
PM2: 2016-04-11 10:35:08: App name:motion id:0 online
PM2: 2016-04-11 10:46:13: Stopping app:motion id:0
PM2: 2016-04-11 10:46:13: App [motion] with id [0] and pid [18928], exited with code [0] via signal [null]
PM2: 2016-04-11 10:46:13: Starting execution sequence in -fork mode- for app name:motion id:0
PM2: 2016-04-11 10:46:13: App name:motion id:0 online
PM2: 2016-04-11 14:21:31: Stopping app:motion id:0
PM2: 2016-04-11 14:21:31: App [motion] with id [0] and pid [19454], exited with code [0] via signal [null]
PM2: 2016-04-11 14:21:31: Starting execution sequence in -fork mode- for app name:motion id:0
PM2: 2016-04-11 14:21:31: App name:motion id:0 online
PM2: 2016-04-12 10:10:17: Stopping app:motion id:0
PM2: 2016-04-12 10:10:17: App [motion] with id [0] and pid [20466], exited with code [0] via signal [null]
PM2: 2016-04-12 10:10:17: Starting execution sequence in -fork mode- for app name:motion id:0
PM2: 2016-04-12 10:10:17: App name:motion id:0 online
motion-0 (out): 2016-04-12 10:10 +02:00: Call Initialization...
motion-0 (out): Member Initialization...
motion-0 (out): QueueMember Initialization...
motion-0 (out): QueueCaller Initialization...
motion-0 (out): 2016-04-12 10:10 +02:00: Recording Initialization...
motion-0 (out): Trunk Initialization...
motion-0 (out): Action Initialization...
motion-0 (out): ACW Initialization...
motion-0 (out): 2016-04-12 10:10 +02:00: QueueMember Initialization...
motion-0 (out): Transfer Initialization...
motion-0 (out): 2016-04-12 10:10 +02:00: Starting Cally Square AGI...
motion-0 (out): 2016-04-12 10:10 +02:00: https://www.xcallymotion.com/api/servers/b4f019a9-d725-497c-85df-c3f0dd33dbcd/check
motion-0 (out): 2016-04-12 10:10 +02:00: Express server listening on 9000, in production mode
motion-0 (out): 2016-04-12 10:10 +02:00: Imap Initialization...
motion-0 (out): 2016-04-12 10:10 +02:00: Smtp Initialization...
motion-0 (out): 2016-04-12 10:10 +02:00: MAIL - Account [email protected] SMTP CREATE
motion-0 (out): 2016-04-12 10:10 +02:00: Triggers are  1
motion-0 (out): 2016-04-12 10:10 +02:00: MAIL - Account [email protected] IMAP CONNECTED
motion-0 (out): 2016-04-12 10:10 +02:00: [127.0.0.1] SOCKET CONNECTED
motion-0 (out): 2016-04-12 10:10 +02:00: socket: user online admin
motion-0 (err):     at Socket.<anonymous> (/var/opt/motion/node_modules/mysql/lib/Connection.js:96:28)
motion-0 (err):     at emitOne (events.js:90:13)
motion-0 (err):     at Socket.emit (events.js:182:7)
motion-0 (err):     at readableAddChunk (_stream_readable.js:153:18)
motion-0 (err):     at Socket.Readable.push (_stream_readable.js:111:10)