• Re: Autostart python in lxterminal?

    From Thomas De Jong@3:770/3 to kol...@bintegratedtech.com on Wed Jul 7 04:57:08 2021
    On Thursday, 18 June 2020 at 12:15:31 UTC+2, kol...@bintegratedtech.com wrote:
    I know this issue is old, but I have been trying to figure out how to get a python script to load using the LXDE-pi/autostart file, and I made it slightly easy on myself to start by creating a /startup dir and a startup.sh that runs all the stuff I
    want to open at startup. I was trying to run one of my scripts that does not have a GUI yet and just runs in the terminal. I was trying to get it to open using the lsterminal --command="python3.7 -c '/startup/scripts/server.py; read'" and it wasnt doing
    anything, tried a few different variations of that command and nothing. I change it to lxterminal -e python3.7 /startup/scripts/server/py & and it works fine now. Thanks for the help. :)


    I have the same issue. Help is appreciated!
    --- SoupGate-Win32 v1.05
    * Origin: Agency HUB, Dunedin - New Zealand | Fido<>Usenet Gateway (3:770/3)
  • From A. Dumas@3:770/3 to Thomas De Jong on Wed Jul 7 14:25:07 2021
    On 07-07-2021 13:57, Thomas De Jong wrote:
    On Thursday, 18 June 2020 at 12:15:31 UTC+2,
    kol...@bintegratedtech.com wrote:
    I know this issue is old, but I have been trying to figure out how
    to get a python script to load using the LXDE-pi/autostart file [...]

    I have the same issue. Help is appreciated!

    What still works in Raspberry Pi OS is to put startup scripts in
    /etc/rc.local

    Make sure to save your script somewhere where the root user can find it,
    like /usr/local/bin, or else specify the complete path. And make sure
    that it runs how you want it to run with that user and from that place.
    Test this by running: sudo myscript.py

    Then put this as the second to last line in /etc/rc.local *before* exit
    0: "myscript.py &". Make sure to add that space-ampersand.

    You don't have to specify the python interpreter on the command line if
    you make the script executable (chmod 755 myscript.py) *and* it has a
    hash-bang as the first line: "#!/usr/bin/env python3" (without the
    quotes). It's probably safer to do that anyway since RPiOS still runs
    python2 as the standard version.

    Also make sure your script doesn't have output, or it outputs to a file.
    --- SoupGate-Win32 v1.05
    * Origin: Agency HUB, Dunedin - New Zealand | Fido<>Usenet Gateway (3:770/3)
  • From Dennis Lee Bieber@3:770/3 to All on Wed Jul 7 11:30:59 2021
    On Wed, 7 Jul 2021 14:25:07 +0200, "A. Dumas" <alexandre@dumas.fr.invalid> declaimed the following:


    What still works in Raspberry Pi OS is to put startup scripts in >/etc/rc.local

    I'd probably avoid any /etc/rc.* since they should be symlinked into the various run-levels, with both startup and shutdown scripts/options as run-levels change.

    crontab using an @boot specification for "time to run", and maybe with a shell delay to ensure system is stable

    @boot delay 60 && python script

    and maybe redirect any output to a log file somewhere.


    --
    Wulfraed Dennis Lee Bieber AF6VN
    wlfraed@ix.netcom.com http://wlfraed.microdiversity.freeddns.org/ --- SoupGate-Win32 v1.05
    * Origin: Agency HUB, Dunedin - New Zealand | Fido<>Usenet Gateway (3:770/3)
  • From A. Dumas@3:770/3 to Dennis Lee Bieber on Wed Jul 7 17:58:48 2021
    Dennis Lee Bieber wrote:
    On Wed, 7 Jul 2021 14:25:07 +0200, "A. Dumas"
    declaimed the following:

    What still works in Raspberry Pi OS is to put startup scripts in
    /etc/rc.local

    I'd probably avoid any /etc/rc.* since they should be symlinked [...]

    Maybe they should but I expressly said this because on RPiOS rc.local is
    not. Old fashioned remnant or not, but it works and is way easier for
    anyone really.
    --- SoupGate-Win32 v1.05
    * Origin: Agency HUB, Dunedin - New Zealand | Fido<>Usenet Gateway (3:770/3)
  • From Martin Gregorie@3:770/3 to Dennis Lee Bieber on Wed Jul 7 16:59:09 2021
    On Wed, 07 Jul 2021 11:30:59 -0400, Dennis Lee Bieber wrote:

    On Wed, 7 Jul 2021 14:25:07 +0200, "A. Dumas"
    <alexandre@dumas.fr.invalid>
    declaimed the following:


    What still works in Raspberry Pi OS is to put startup scripts in >>/etc/rc.local

    I'd probably avoid any /etc/rc.* since they should be symlinked
    into
    the various run-levels, with both startup and shutdown scripts/options
    as run-levels change.

    Also, the /etc/rc.* were used by the UNIX V init system control scripts
    which wiere initially used by Linux, but which have now been obsoleted by systemd. While systemd does still run System V process control scripts,
    sooner or later they'll be obsoleted and will need to be replaced by
    systemd process control scripts so, it might be a god idea to use systemd process control scripts from the getgo. There's fairly decent, readable documentation for writing them here:

    https://www.freedesktop.org/wiki/Software/systemd/


    crontab using an @boot specification for "time to run", and maybe with
    a shell delay to ensure system is stable

    A description of the cron daemon, which starts programs that you want to
    run at fixed times of the day or week can be seen by running "man cron"
    and "man 5 crontab" describes the files that control this process and
    what to put in them.

    As an example, I use cron to fetch mail from my ISP every 10 minutes and
    also to do housekeeping tasks such as making daily backups at around 3AM
    every day, so that (a) I don't have to remember to do it and (b) this
    stuff gets done when I'n not using the machines for anything else.


    --
    Martin | martin at
    Gregorie | gregorie dot org
    --- SoupGate-Win32 v1.05
    * Origin: Agency HUB, Dunedin - New Zealand | Fido<>Usenet Gateway (3:770/3)