Recent

Author Topic: Run at start  (Read 1287 times)

Bolker_89

  • Newbie
  • Posts: 3
Run at start
« on: November 23, 2020, 02:10:57 pm »
Hello,
i'm new in lazarus and i have a question.

I have a lazarus-fp project on raspbian (raspberry pi3).
I would like to start the program when the raspberry starts but without opening lazarus. In short, just the application.
How is this done?

Thanks in advance.

birin

  • New member
  • *
  • Posts: 9
Re: Run at start
« Reply #1 on: November 23, 2020, 04:43:12 pm »
Hello Bolker_89,

that is not a Lazarus question, is only a OS question.
When you compile your program with Lazarus it creates an executable file of your program.
You need only to copy this file on your raspberry (if you ave compiled in other computer) and run it, or run it in starting time from your OS.

But you not need Lazarus on your raspberry to run your compiled program.

Bolker_89

  • Newbie
  • Posts: 3
Re: Run at start
« Reply #2 on: November 23, 2020, 05:12:08 pm »
Hi,
if I run the executable, rasp show me a tab "select an application to open "Executable DOS/Windows files".

which one should I choose or what i have to do? (i'm working on Raspbian)

lucamar

  • Hero Member
  • *****
  • Posts: 4219
Re: Run at start
« Reply #3 on: November 23, 2020, 05:25:09 pm »
if I run the executable, rasp show me a tab "select an application to open "Executable DOS/Windows files".

That means that you compiled and are trying to run a Windows (or DOS) .EXE on a Linux system, which won't work unless you've, for example, a properly installed Wine.

Otherwise you have to compile your program for Linux (gtk2) OS and ARM processor targets, using a cross-compiler if you're programming and compiling on Windows and transferring the executable to the RPi.
Turbo Pascal 3 CP/M - Amstrad PCW 8256 (512 KB !!!) :P
Lazarus/FPC 2.0.8/3.0.4 & 2.0.12/3.2.0 - 32/64 bits on:
(K|L|X)Ubuntu 12..18, Windows XP, 7, 10 and various DOSes.

Bolker_89

  • Newbie
  • Posts: 3
Re: Run at start
« Reply #4 on: November 24, 2020, 02:15:25 pm »
Thanks for the tips but I need one more thing.

I can start the program but I would like it to start when the Raspberry is turned on.
I have searched various places but have not yet managed to find out.

How can I do?

Thanks ::)

lucamar

  • Hero Member
  • *****
  • Posts: 4219
Re: Run at start
« Reply #5 on: November 24, 2020, 03:02:54 pm »
That depends on the specific startup your system uses (which in Raspbian, IIRC, is systemd?) and it's really an OS question. Googling "running a program at Linux startup" should find you plenty answers and hint to fiddle with (e.g. How to automatically run program on Linux startup)

Note, though, that most persistent* "programs" run at startup have to be services/daemons; standard "one-shot" utils and tools can be launched by startup scripts but they have to end in a reasonable time or they will lock the startup, resulting in an unusable system.

If what you want instead is a program that runs automatically when the desktop starts, most desktops have a configuration editor that allows you to add programs, more or less (though not exactly) like you'd do in "autoexec.bat" in the good old DOS days. Yet again, googling for it (like e.g. "run program at gnome startup") will give you plenty answers for it.

HTH!


* persistent as in a program which is launched without waiting for its output, and runs basically from system startup to close-down, like e.g. the network daemons, etc.
« Last Edit: November 24, 2020, 03:10:21 pm by lucamar »
Turbo Pascal 3 CP/M - Amstrad PCW 8256 (512 KB !!!) :P
Lazarus/FPC 2.0.8/3.0.4 & 2.0.12/3.2.0 - 32/64 bits on:
(K|L|X)Ubuntu 12..18, Windows XP, 7, 10 and various DOSes.

Thaddy

  • Hero Member
  • *****
  • Posts: 14373
  • Sensorship about opinions does not belong here.
Re: Run at start
« Reply #6 on: November 24, 2020, 05:11:51 pm »
schedule your program as a cron job.
Object Pascal programmers should get rid of their "component fetish" especially with the non-visuals.

 

TinyPortal © 2005-2018