I have a 22.04 server running PM2 on it to provide some node applications. These applications rely on a shell variable that says if the environment is 'dev' or 'prd'
Every time I reboot the system I have to run
export ENV_TYPE = 'dev'
and then restart all the PM2 processes with
pm2 restart 0 --update-env
pm2 restart 1 --update-env
and so on
How can I build a script that will perform these actions automatically when I reboot the server (not after login, right at the end of boot procedures)? Later on I will look into run the script but now the goal is to create the script