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!
/usr/bin/tmux
and/usr/bin/node
– Doan Van Thang Apr 22 '20 at 15:58/etc/rc.local
has limitations due to Compatibility with SysV. We have seen many problems here on this site using it. Following the recommendation of the developers from systemd you should avoid using it. Does the command run from the commandline successfully? Does it has any output on the console or graphical? – Ingo Apr 23 '20 at 08:08