@jamgames2 please check where is issue:
I try also in this way and create script hook for create_database_post.sh
Code:
#!/bin/bash
# 'username'
username=${username}
# Install NVM as the specified user
curl -o- https://raw.githubusercontent.com/creationix/nvm/v0.34.0/install.sh | bash
# Install Node.js version 18 using NVM
nvm install 18
# Install PM2 globally
npm install -g pm2
# Install Yarn globally
npm install -g yarn
This above bash script install but as ROOT user, and when I switch to user level then still I cant access.
So I try directly in bash script su to username and install:
Code:
#!/bin/bash
# 'username'
username=${username}
# Install NVM as the specified user
sudo -u $username bash -c 'curl -o- https://raw.githubusercontent.com/creationix/nvm/v0.34.0/install.sh | bash'
# Reload the terminal to apply NVM changes
#exec bash
# Install Node.js version 18 using NVM
sudo -u $username bash -c 'nvm install 18'
# Install PM2 globally
sudo -u $username bash -c 'npm install -g pm2'
# Install Yarn globally
sudo -u $username bash -c 'npm install -g yarn'