dma5m561
Posts: 8
Joined: Mon Jul 06, 2015 8:02 pm

Re-starting an autostarted application

Mon Jul 06, 2015 8:32 pm

Hello all, I'm very new to this forum and also to Raspberry Pi's and Linux so I'm seeking some help and advice... :)

I've built a GPS-derived stratum 1 NTP server on a 'headless' Pi Model B (not B+), using the add-on GPS board from HAB Supplies and the excellent instructions provided by Anthony Stirk at: http://ava.upuaut.net/?p=726&cpage=1#comment-170232.

Although my familiarity with and experience of Linux is absolutely minimal I was able successfully to get the NTP server up and running without any hiccups; it then occurred to me that it would be nice to add a small display to the Pi so that I could have an accurate time-of-day clock so I followed the further set of excellent instructions provided by David Taylor at: http://www.satsignal.eu/raspberry-pi/DigitalClock.html

I now have a Pi with a 5inch 800 x 480 LCD connected to the RCA composite video output that autostarts the DigitalClock program when it boots up, and this is working beautifully.

I can SSH (using puTTY) into the 'DigitalClock' and NTP-serving Pi from the several Windows 7 PCs on my home LAN - I do this occasionally to check the NTP server's accuracy using the 'ntpq -p' command - but I'd also like to be able occasionally to kill the DigitalClock process then amend its .ini settings and restart it, and therein lies my problem...

There's a file in /home/pi/.config/autostart called DigitalClock.desktop; this contains the following:

[Desktop Entry]
Name=DigitalClock
Exec=/home/pi/arvclock/DigitalClock
Terminal=False
Type=Application

Is there any way of using a command entered from the SSH command line to restart the DigitalClock program in exactly the same way as it would autostart after a reboot of the Pi? In other words, how can I instruct the Pi to 'execute' the DigitalClock.desktop file again?

Thanks in advance for your help, which will be much appreciated by a novice Pi'er...!

--
Martin
--
Martin

sprinkmeier
Posts: 410
Joined: Mon Feb 04, 2013 10:48 am
Contact: Website

Re: Re-starting an autostarted application

Mon Jul 06, 2015 9:41 pm

Start an SSH/PuTTY session, then

Code: Select all

screen
DISPLAY=:0 /home/pi/arvclock/DigitalClock
and close the window.

screen creates a virtual terminal which persists after you close the window (i.e. DigitalClock won't exit when you close the PuTTY terminal)

Linux uses the X windows manager for GUI displays.
DISPLAY=:0 tells DigitalClock to send its output to the zero-th display (i.e. the default one started at boot which is connected to the monitor).

dma5m561
Posts: 8
Joined: Mon Jul 06, 2015 8:02 pm

Re: Re-starting an autostarted application

Sun Jul 12, 2015 8:52 pm

Hello Sprinkmeier, many thanks for your suggestion of using the 'screen' and 'DISPLAY=:0' commands which seem to do exactly what I want, so I can now tinker with the DigitalClock's config settings without having to reboot the Pi every time to get the program to restart.

--
Martin

Return to “Beginners”