Program that Starts other programs

Post your Gambas programming questions here.
Post Reply
AndyGable
Posts: 359
Joined: Wednesday 2nd December 2020 12:11am
Location: Northampton, England
Contact:

Program that Starts other programs

Post by AndyGable »

Hi All,

Just wanted to run this idea past your Gambas Experts

what I want to do is have a Small Start up app that load when Linux boots and it will wait for 30 seconds (so Linux can establish network etc) and then it will start

The Program basically would load a list of what to start and then it would start

For example

Start EpsonModule.gambas and moves on (Printer Module for the EPson TM-88 Range)
start EpsonDMModule.gambas and moves on (Customer display from Epson)
Start DataSync with the /update and wait for the app to complete (it would then exit)
Start DataSync with the /rts and move on
Start NPoS (retail softyware) and then exit StartApp

I had one for Windows i just wondered if it could be done on Linux
User avatar
cogier
Site Admin
Posts: 1118
Joined: Wednesday 21st September 2016 2:22pm
Location: Guernsey, Channel Islands

Re: Program that Starts other programs

Post by cogier »

I am running Linux Mint 21 with the Cinnamon desktop. It has "Startup applications" menu. Here you can see my music player that will wait for 15 seconds before starting. I expect other distros have something similar. Does this help?

Image
AndyGable
Posts: 359
Joined: Wednesday 2nd December 2020 12:11am
Location: Northampton, England
Contact:

Re: Program that Starts other programs

Post by AndyGable »

cogier wrote: Friday 18th November 2022 3:07pm I am running Linux Mint 21 with the Cinnamon desktop. It has "Startup applications" menu. Here you can see my music player that will wait for 15 seconds before starting. I expect other distros have something similar. Does this help?

Image
I'm on Debian 11 and yes it has something like that but I want to be able to send Commands and wait for applciations to load and exit before carrying on

It would be the Linux version of the PoSStart App I have for my Windows versions it boots when Explorer starts and helps to lock down the PoS Terminal
User avatar
thatbruce
Posts: 161
Joined: Saturday 4th September 2021 11:29pm

Re: Program that Starts other programs

Post by thatbruce »

No need to reinvent the stone hammer. sysvinit can do all this, systemd probably can as well but I couldn't be ... to find out if and how.
Have you ever noticed that software is never advertised using the adjective "spreadable".
AndyGable
Posts: 359
Joined: Wednesday 2nd December 2020 12:11am
Location: Northampton, England
Contact:

Re: Program that Starts other programs

Post by AndyGable »

I know about the start up function on Debian the problem is that does not wait for applications to do what they need to do.

For example when my system first boots the DataSync app does a full download from the back office (this can take anything from 5mins to 30mins depending on the size of the database) once that has downloaded the app quits and then I need to restart it in real-time sync mode ( DataSync /rts)

Can the start up function of the GUI do that? Or do I need to have my own app to do that (like I've been planning)

Also is it possible to close everything down when the desktop has fully loaded? (In windows I just had to close the explorer.exe and I then had nothing else running just my PoS application)
User avatar
thatbruce
Posts: 161
Joined: Saturday 4th September 2021 11:29pm

Re: Program that Starts other programs

Post by thatbruce »

I might have accidentally stumbled on a simple solution for you.
In your "startup" project try using

Code: Select all

Shell <cmd+args> WAIT
e.g. 
Shell "xfce4-terminal -e 'ls -l' -H" Wait 
( It was sitting in a v old program we use to swap between various object editors. It never occurred ...)

b
Have you ever noticed that software is never advertised using the adjective "spreadable".
AndyGable
Posts: 359
Joined: Wednesday 2nd December 2020 12:11am
Location: Northampton, England
Contact:

Re: Program that Starts other programs

Post by AndyGable »

So I would try

SHELL "./algPoS/DataSync/DataSync.Gambas /Firstboot" WAIT


SHELL "./algPoS/DataSync/DataSync.Gambas /rts" &
User avatar
thatbruce
Posts: 161
Joined: Saturday 4th September 2021 11:29pm

Re: Program that Starts other programs

Post by thatbruce »

Probably/possibly yes, but I would try it in a terminal emulator first.

As in, invoke your local terminal emulator with a command to execute and a "hold" so you can see what happens. That is what I have there:
Shell "xfce4-terminal -e 'ls -l' -H" Wait

xfce4-terminal is my local terminal emulator
-e tells it to execute the command "ls -l" which is fairly generic so you can test this on your hardstuff
-H is specific to xfce4-terminal, so you need to research your specific situation.
and, yes the Wait tells the gambas runtime to wait till the command has finished,

SO, for you, maybe Shell "numpy-term --runcommand path to /DataSync.gambas -args" Wait
notes:
1) path to : DONT use relative pathing! It wont work as you expect outside the IDE
2) understand the difference between an argument and an option. Arguments are usually numbers or else quoted according to what your shell needs. A shell only understands numbers and strings, not paths nor dates nor anything else. Options are a different kettle of fish, they start (usually) with -- or - and have lots of ramifications. See the help on the Args component.

I think that's all :?
b

[Mod] No, there's one more!
Unlike another operating system, Linux is case sensitive. That's why I said /DataSync.gambas in bold above.
Have you ever noticed that software is never advertised using the adjective "spreadable".
AndyGable
Posts: 359
Joined: Wednesday 2nd December 2020 12:11am
Location: Northampton, England
Contact:

Re: Program that Starts other programs

Post by AndyGable »

Thanks for the advise I will try that when I am back in the office
Post Reply