how to autorun script at startup as administrator?
Gene Heskett
gheskett at shentel.net
Tue Dec 17 02:35:36 UTC 2019
On Sunday 15 December 2019 22:20:52 Dave Stevens wrote:
> The subject line pretty much says it, I have a script to read and save
> serial data from an attached sensor. I ssh in and sudo <scriptname>
> and data gets read in and accumulates. From time to time (every few
> weeks) there's a power interruption at the remote site where the
> sensor and computer are. The box (Mint) restarts when power is
> restored and currently I need to restart the script as set out above.
>
> How can I ensure that the script will start too when power is
> restored?
>
> The computer and sensor are powered alike, sensor power comes over the
> USB port it's wired to, the sensor has no power switch, if there's
> power it just reboots and starts.
>
> For specificity it's a Plantower PMS5003 particulate sensor wired to a
> usb cable that incorporates an inline UART to serve as a level
> shifter.
>
> More details I can provide? references? will RTFM if pointed to one.
>
> TIA
>
> Dave
One way is to make sure /etc/rc.local is executable, and put the script
starter command line(s) in it. It should then be started just before it
throws up a login screen. If the script doesn't return, be sure and
terminate the command line with a &, otherwise you might be hung without
a login. Thats called bad form I think. And you'll have to reboot to
single user to fix it.
Cheers, Gene Heskett
--
"There are four boxes to be used in defense of liberty:
soap, ballot, jury, and ammo. Please use in that order."
-Ed Howdershelt (Author)
If we desire respect for the law, we must first make the law respectable.
- Louis D. Brandeis
Genes Web page <http://geneslinuxbox.net:6309/gene>
More information about the ubuntu-users
mailing list