#Automating Process Termination for Nuxt Server

15 messages · Page 1 of 1 (latest)

coarse creek
#

use systemd

#

then you can just run systemctl restart <process>

pastel prairie
# coarse creek use systemd

Thanks, but I am still not sure, what to run in my automated script?

Automated script:

npm install
npm run build

I need to kill the process here, but I do not know which process
coarse creek
#

systemctl manages that for you

#

it knows the PID

#

it will kill it and start it for you

pastel prairie
coarse creek
#

it will automatically restart the process if it dies

#

it will automatically store the logs for you in the journal

#

you can make it auto startup on boot

pastel prairie
#

Ok, so how often should i run it? After ever build?

coarse creek
#

yes, otherwise it will still be running the old version

pastel prairie
coarse creek
pastel prairie
# coarse creek https://nodesource.com/blog/running-your-node-js-app-with-systemd-part-1/

Thanks for the link.

But I am still not sure, what to enter in my below automated yaml script for killing the process after build:

name: Build on main branch update

on:
  push:
    branches:
      - main

jobs:
  build:
    runs-on: ubuntu-latest
    
    steps:
    - name: Checkout code
      uses: actions/checkout@v2
    
    - name: Install Node.js
      uses: actions/setup-node@v2
      with:
        node-version: '14'
    
    - name: Install dependencies
      run: npm install
    
    - name: Build project
      run: npm run build