Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

A restart occurs when app.js runs #3

Open
rad978 opened this issue Oct 23, 2023 · 1 comment
Open

A restart occurs when app.js runs #3

rad978 opened this issue Oct 23, 2023 · 1 comment

Comments

@rad978
Copy link

rad978 commented Oct 23, 2023

Hello, after entering the node app.js command, Raspberry restarts. This happens every time I try to run app.js Please advise.

@Miniontoby
Copy link

Miniontoby commented Jun 9, 2024

Rebooting seems to be intentional:

exec("sudo reboot", (err, stdout, stderr) => {

However, it should only do that if the hostname is atem-tally or raspberrypi:

atem-tally-pi/app.js

Lines 125 to 136 in 3ab3b4d

// Generate and set a unique hostname if default hostname is being used
if (os.hostname() == "atem-tally" || os.hostname() == "raspberrypi") {
var shortid = getDevId().substring(0, 8);
exec("sudo hostnamectl set-hostname atem-tally-" + shortid, (err, stdout, stderr) => {
if (err) {
console.error(`Error: ${err}`);
return;
}
console.log(`stdout: ${stdout}`);
console.error(`stderr: ${stderr}`);
});
exec("sudo reboot", (err, stdout, stderr) => {

Can you check if the hostname has been changed after the restart?
If not, then you can change the hostname manually, see this line of code where this script sets the hostname:

exec("sudo hostnamectl set-hostname atem-tally-" + shortid, (err, stdout, stderr) => {

If that command gives an error, then that would be the reason why the raspberry pi keeps rebooting when you run app.js

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants