-
Forum
-
Main Forum
-
Arduino Nixie Clock Kit Support Forum
-
Setting up and running a time-zone-server on Raspberry pi
Setting up and running a time-zone-server on Raspberry pi
Less
More
-
Posts: 33
-
Thank you received: 3
-
-
1 month 5 days ago - 1 month 5 days ago #12261
by Jedidiah
I'm trying to set up a time zone server on my Raspberry Pi (running Raspbian) according to
github.com/isparkes/time-zone-server
.
I finally got it to run successfully, but if my Pi is rebooted, I must do the following on the pi to restart the server:
nvm use 6.17.1
cd time-zone-server
nohup node time-zone-service.js > log.txt &2>1
Is there a way to automate this? Appreciate the help!
Or perhaps I should just update the ESP8266 firmware???
Last edit: 1 month 5 days ago by
Jedidiah. Reason: additional question
Please Log in or Create an account to join the conversation.
Less
More
-
Posts: 1122
-
Karma: 1
-
Thank you received: 120
-
-
-
-
1 month 5 days ago #12264
by Ian
I have just automated it using a crontab entry:
# m h dom mon dow command
0 5 * * * ~/bin/pull-gits.sh
@reboot /bin/sleep 60 && /home/pi/time-zone-server/run.sh 2> /home/pi/time-zone-server/cron.err > /home/pi/time-zone-server/cron.out
and the script:
pi@raspberrypi:~ $ cat /home/pi/time-zone-server/run.sh
cd /home/pi/time-zone-server/
nohup /usr/local/bin/node time-zone-service.js >> tzs.log &
Please Log in or Create an account to join the conversation.
Less
More
-
Posts: 1122
-
Karma: 1
-
Thank you received: 120
-
-
-
-
1 month 5 days ago #12265
by Ian
And if you want to update, the new version has some cool things like OTA (Over The Air) Updates and so on. But why fix it if it ain't broke?
Please Log in or Create an account to join the conversation.
Less
More
-
Posts: 1592
-
Karma: 2
-
Thank you received: 172
-
-
-
-
-
1 month 4 days ago #12267
by Ty_Eeberfest
I am little more than a Raspbian noob. I'm posting this because 1) it worked for me and 2) maybe someone who knows more than I can tell me if this method is good/bad/indifferent.
All I did is edit the global autostart. The file belongs to root so you need to edit with elevated privilege (e.g. $ sudo nano autostart or $ sudo vi autostart). The file to edit is
/etc/xdg/lxsession/LXDE-pi/autostart
I appended this to the end of the file:
@nohup node /home/pi/time-zone-server/time-zone-service.js >> tzs.log
Caveat: I edited the global autostart file which is run at startup regardless of which user is logging in. If you happen to have a user autostart file the global autostart is ignored. User autostart, if it exists, is found at:
~/.config/lxsession/LXDE-pi/autostart
(If using the GUI file manager you must turn on View->Show Hidden in order to see the .config directory branch!)
If you find you have a user autostart then you should edit it as above instead of editing the global autostart.
Look into it later when the dust is clearing off the crater.
Please Log in or Create an account to join the conversation.
Less
More
-
Posts: 1122
-
Karma: 1
-
Thank you received: 120
-
-
-
-
1 month 4 days ago #12268
by Ian
Hi Ty, that will work as well. I'm a bit of a Linux Nazi, so I wouldn't choose to do it that way, simply because it's a user land process and it doesn't belong in there. (I think you'll find that is it running as root).
But there are many ways to skin a cat.
Please Log in or Create an account to join the conversation.
Less
More
-
Posts: 1592
-
Karma: 2
-
Thank you received: 172
-
-
-
-
-
1 month 4 days ago #12269
by Ty_Eeberfest
Ian wrote: I'm a bit of a Linux Nazi, so I wouldn't choose to do it that way, simply because it's a user land process and it doesn't belong in there.
And that is precisely the kind of feedback I was hoping for. If I'm ever to progress beyond noob level with my pi I want to do things right.
Ian wrote: (I think you'll find that is it running as root).
After reading your post that is what I expected to find but oddly it's running as user "pi". I can't explain it.
Ian wrote: But there are many ways to skin a cat.
Indeed. Every time I look for something Linux related online I seem to find a dozen conflicting answers and can only guess at the quality of said answers. Oh well, live and learn.
Look into it later when the dust is clearing off the crater.
Please Log in or Create an account to join the conversation.
-
Forum
-
Main Forum
-
Arduino Nixie Clock Kit Support Forum
-
Setting up and running a time-zone-server on Raspberry pi
Time to create page: 0.123 seconds