Jump to content
Search In
  • More options...
Find results that contain...
Find results in...

how to shootdown ubuntu after application ends


Recommended Posts

Hi, it's been a long time from my last post here :(

I'm finishing a Leadwerks program on ubuntu 16.04, not a game, is a 3d graphical interface for a "Shoot simulator" with real (modified) guns.

I'm so novice with linux, so after some reading i got the application run at startup.

This application is the only one which will run on this pc, so it should start at startup and the system should shootdown when quitting from the application.

(after try and pray many times... :( )

Basically i end placing a .desktop file in .config\autostart directory with a exec command to the leadwerks script to run the project file, so simple once one get to know how :)

I guess that, i can place a shootdown command on the launch script, but I did not find the way, all my readings point to: shootdown -h now

(edit: i mean.. shutdown not shootdown)

but, i guess i'm not doing, writting, placing it in the correct way.

Some linux expert here?

Thank's in advance

Juan

Link to post
Share on other sites

thanks for answer :)

 

i have this file in .config/autostart

Quote

[Desktop Entry]
Encoding=UTF-8
Name=Simulador1
Comment=Launch DirSyncPro
Exec=gnome-terminal -e /home/juan/Documents/Leadwerks/Projects/pj01/pj01.sh
Icon=/usr/share/icons/HighContrast/32x32/apps/gnomine.png
Type=Application

also works with:

Quote

[Desktop Entry]
Encoding=UTF-8
Name=Simulador2
Comment=Launch DirSyncPro
Exec=/home/juan/Documents/Leadwerks/Projects/pj01/pj01.sh
Icon=/usr/share/icons/HighContrast/32x32/apps/gnomine.png
Type=Application

and the pj01.sh is:

Quote

cd /home/juan/Documents/Leadwerks/Projects/pj01
export LD_LIBRARY_PATH=".:${LD_LIBRARY_PATH}"
exec "./pj01" "$@"

i write the line

Quote

shutdown -h now

after exec, but after pj01 ends, system do not shoot down

if I open a terminal, shutdown -h now, works ok

i try other combinations but, due to my lack of knowledge on the subject... i somewhat lost :)

Quote

cd /home/juan/Documents/Leadwerks/Projects/pj01
export LD_LIBRARY_PATH=".:${LD_LIBRARY_PATH}"
exec "./pj01" "$@"

shutdown -h now

and with the !bin/bash

Quote

#!/bin/bash

cd /home/juan/Documents/Leadwerks/Projects/pj01
export LD_LIBRARY_PATH=".:${LD_LIBRARY_PATH}"
exec "./pj01" "$@"

shutdown -h now

 

Juan

 

Link to post
Share on other sites

thanks, but nope

if i open a terminal and execute the pj01.sh script, the leadwerks app starts ok, and after it, simply the terminal again

last line of leadwerks throws :

AL lib: (EE) alc_cleanup: 1 device not closed


then, the propmt.

(and, no other command on the script seems to be executed)

 

Link to post
Share on other sites

Ah, ok!

yes, now, it shutdown if i run it from a terminal

not if I use the .desktop shortcut

Quote

cd /home/juan/Documents/Leadwerks/Projects/pj01
export LD_LIBRARY_PATH=".:${LD_LIBRARY_PATH}"
./pj01 "$@"
shutdown -h now

this is the pj01.sh now

Link to post
Share on other sites

the thing now is how or from where I execute this script, because if i launch it from .config/autostart it start the leadwerks app, but do not shutdown the system

my idea was that turning on the PC the app autostart and when quitting it, the system shutdown

Is there other way to autostart an app?

 

Link to post
Share on other sites

well, if i place a .xsessionrc file with:

Quote

/home/juan/Documents/Leadwerks/Projects/pj01
gedit "pj01.sh" &

then ubuntu starts, exec gedit and gedit open the pj01.sh file located in the above directory

but if, instead of gedit i place ./pj01.sh then LE app do not start

 

Link to post
Share on other sites

well, now I have another problem, my bad

i placed a shutdown line after gedit, to test if the systems shotsdown after gedit, and found that the system start and shutdown (no gedit)

is there a way of intercept startup and open a terminal so I can delete the .xsession file?

thanks

Link to post
Share on other sites

Which bootloader do you use? In the case of grub (Ubuntu default), you can press "e" before the countdown runs out and then modify the boot-string by simply appending "init=/bin/bash" to the end of the line which starts with "linux    /boot/vmlinuz...". You might need to manually mount your harddrives before you can access them, not sure.

  • Thanks 1
Link to post
Share on other sites

It's more hardware than software, leadwerks part is to have something to shoot :).

Guns have infrared lasers, a camera system detects where the gun is in the screen, then with some maths to translate corrds to leadwerks, a camera pick, and that's it. Simply put.

Electronics simulate the gun behavior, and as you will see, I'm not an expert :)

  • Like 1
Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...