Node.js crontab中的计划节点脚本不';重新启动后无法运行

Node.js crontab中的计划节点脚本不';重新启动后无法运行,node.js,cron,scheduled-tasks,Node.js,Cron,Scheduled Tasks,通过将以下行添加到/etc/crontab,我已计划在crontab中的节点脚本在重新启动后运行: @reboot /home/eugen/Documents/scripts/tests/run_after_boot/index.js /home/eugen/Documents/scripts/tests/run\u after\u boot/index.js文件包含此脚本,该脚本应打开vscode: const { exec } = require('child_process'); exe

通过将以下行添加到/etc/crontab,我已计划在crontab中的节点脚本在重新启动后运行:

@reboot /home/eugen/Documents/scripts/tests/run_after_boot/index.js
/home/eugen/Documents/scripts/tests/run\u after\u boot/index.js文件包含此脚本,该脚本应打开vscode:

const { exec } = require('child_process');
exec('code', (err, stdout, stderr) => {
  if (err) {
    //some err occurred
    console.error(err)
  } else {
   // the *entire* stdout and stderr (buffered)
   console.log(`stdout: ${stdout}`);
   console.log(`stderr: ${stderr}`);
  }
});
重新启动后,不会发生任何事情。此外,我还试图通过在终端中执行
crontab-e
命令来添加相同的行(
@reboot/home/eugen/Documents/scripts/tests/run\u after\u boot/index.js
),但出现了相同的问题:重新启动后什么也没有发生