Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

111
Vistas
A node command runs manually but crontab crashes

I have a discord bot that I made and I used to use crontab to have it just restart and update the bot automatically each day at 2 am. At some point recently it stopped working but I don't know why. The script is the following:

#!/usr/bin/bash
echo "Killing application..."
pkill -9 node
echo "Moving to bot dir..."
cd /home/pi/theBot/
git pull
npm install
echo "Starting bot..."
node /home/pi/theBot/bot.js

When I run this manually it works just fine and starts up perfect. When it runs through crontab however, it gets errors presumably related to optional chaining in my node project; it cites a line that goes:

if(msg.mentions?.users?.size > 0) {

I normally run node v14.17.6 but I installed and am using v16.13.0 and npm v8.1.0.

about 4 years ago · Juan Pablo Isaza
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda