In order to run
Node script in Pi, I set up a
crontab task in Pi last Tuesday after class and left the device running on floor. But it turned out not sending data to server as expected. The challenges I got including:
@rebootcommand seemed not working properly
Pigot rebooted and kept running, or to be executed once in an hour by crontab?
sudorequired in a crontab command?
rootor certain user?
/etc/crontabfile instead of
crontab -e, but is it necessary?
Because I failed to set the task up properly, I tried to use
job control to run the program in the background as Mark suggested. And it worked perfectly.
& at the end of the command to execute and run the script in background constantly. But be careful not to run multiple same programs accidentally. Use
ps -aux instead of only
ps to show every processes running in background, including those not attached to a terminal . If there's duplicated ones, kill them.