Multiple discord bots on startup

Status
This thread has been locked.

Donut

Supreme
Feedback score
29
Posts
667
Reactions
368
Resources
0
Hello, im trying to start multiple discord bots on startup, the first bot starts fine but the other ones do not, here is the code from my 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.

cd /home/bot-1
node index.js
cd /home/bot-2
node index.js
cd /home/bot-3
node index.js
cd /home/bot-4
node index.js
cd /home/bot-5
node index.js

exit 0``
 
PebbleHost
High performance, consistent uptime and fast support. Minecraft hosting that just works.

O-T

IT Consultant
Supreme
Feedback score
51
Posts
168
Reactions
124
Resources
0
Can't you just send the node commands to background by adding a trailing " &"?
 

O-T

IT Consultant
Supreme
Feedback score
51
Posts
168
Reactions
124
Resources
0
I believe that since a node.js app usually runs until it is ended or terminated, and that it occupies the terminal that'd make you unable to run more commands, so I'd try to add a " &" to your commands, i.e
node index.js &
That'd send the command to the background yet the stdout would still be attached to the terminal but you'd be able to run new commands, or you can use a terminal multiplexer to run each instances in a different terminal.
 
Last edited:

Donut

Supreme
Feedback score
29
Posts
667
Reactions
368
Resources
0
I believe that since a node.js app usually runs until it is ended or terminated, and that it occupies the terminal that'd make you unable to run more commands, so I'd try to add a " &" to your commands, i.e
node index.js &
That'd send the command to the background yet the stdout would still be attached to the terminal but you'd be able to run new commands, or you can use a terminal multiplexer to run each instances in a different terminal.
Ok thanks, ill try that
 

bl4ckspr4y

Premium
Feedback score
8
Posts
43
Reactions
15
Resources
0
You could make them systemd services and enable them to make them start at boot.
 
Status
This thread has been locked.
Top