All I want is create a bash script that runs another bash script in a different folder, but with a detached screen session. Also it should be executed as non-root user. Here's what I've done:
#!/bin/sh
cd /bot/ && screen -S Bot -d -m ./bot.sh
chmod +x script.sh
After running it with ./script.sh
, it doesn't give me an error, but no response.
Also I tried with:
#!/bin/sh
screen -S Bot -d -m -c "cd bot" && ./bot.sh
And come up with this error:
./script.sh: line 1: bot.sh: No such file or directory
I've a little question too: how can I make a script to track on this session to run it back if session or bot terminates? Thanks in advance.