0

I'm hosting a discord bot on my raspberry pi and I want it to create new session on start up

I have tried with edit rc.local :

#!/bin/sh -e
#
# rc.local
#
# This script is executed at the end of each multiuser runlevel.
# Make sure that the script will "exit 0" on success or any other
# value on error.
#
# In order to enable or disable this script just change the execution
# bits.
#
# By default this script does nothing.

# Print the IP address
_IP=$(hostname -I) || true
if [ "$_IP" ]; then
  printf "My IP address is %s\n" "$_IP"
  /usr/bin/tmux new-session -d "cd /home/pi/myBot; sudo node index.js"
fi

exit 0

However it didn't work, when I check with tmux a, it said no sessions

Any help would be much appreciated!

0 Answers0