Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question?
If it is not in the man pages or the how-to's this is the place! |
Notices |
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
Are you new to LinuxQuestions.org? Visit the following links:
Site Howto |
Site FAQ |
Sitemap |
Register Now
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
|
|
|
02-01-2017, 01:47 PM
|
#1
|
LQ Newbie
Registered: Oct 2016
Posts: 20
Rep:
|
Systemd, problem to start an old Program on boot under Ubuntu 16.04
Hallo,
I'm a real newbie in Linux and for some months now I'm trying to bring an old program to ubuntu 16.04.
After some problems I finaly managed to get it to run under ubuntu 16.04 LTS.
It's realy runing fine and I may start the program in the Terminal, or by doubleklicking an Autostart.sh file or by doubleclicking a desktop-icon which I have created using a .desktop file.
The only thing left, is to start the program automatically after the booting of my linux PC.
In my old system it was started by initd , I think I must do this with systemd now.
I red the man pages several tutorials, lots of threats, but I'm still stuck.
The content of the working autostart.sh is:
Code:
# bin/bash
cd /path/to/the/program
./run program -option1 -option2
The program-folder contains 3 files :
two are executable : run and program
one is phyton script called update
when I write a Unit with ExecStart=run , some update checkings are performed
when I write ExecStartPre=run and ExecStart=program , the update checks are performend but the program does not start
In systemctl status I get code=killed status=9
Do you have some tips how I can troubleshoot this?
Thank's
EDIT: do you know how I have to submit the -option1 in the Unit-file (.service) ?
Last edited by jumperger; 02-01-2017 at 01:53 PM.
|
|
|
02-01-2017, 06:35 PM
|
#3
|
Member
Registered: Apr 2007
Location: Oxfordshire, UK
Distribution: Arch, Sparky, Salix64
Posts: 122
Rep:
|
Ubuntu (well, Xubuntu at least) has an /etc/rc.local script, which works to start things on boot. I'm not sure if any other systemd systems use it (I mainly use Arch, which doesn't), but I would use that.
Code:
#!/bin/sh -e
#
# rc.local
#
# This script is executed at the end of each multiuser runlevel.
# Make sure that the script will "exit 0" on success or any other
# value on error.
#
# In order to enable or disable this script just change the execution
# bits.
#
# By default this script does nothing.
exit 0
including your autostart.sh (with full path) should solve the problem for you without having to delve into creating systemd units.
Paul.
|
|
|
02-01-2017, 11:01 PM
|
#4
|
LQ Newbie
Registered: Oct 2016
Posts: 20
Original Poster
Rep:
|
Thank's for the links,
these were the pages I mainly used to dig into systemd
@ Paul
Yes my Ubuntu 16.04 has the etc/rc.local script.
so I added the line:
Code:
/root/program/scripts/autostart.sh
but it did not show my program after reboot.
Then I changed the line to :
Code:
sudo /root/program/scripts/autostart.sh
with no result
|
|
|
02-01-2017, 11:46 PM
|
#5
|
LQ Guru
Registered: Nov 2008
Location: Pictland
Distribution: Linux Mint 21 MATE
Posts: 8,048
|
|
|
|
02-02-2017, 11:34 AM
|
#6
|
LQ Newbie
Registered: Oct 2016
Posts: 20
Original Poster
Rep:
|
When adding a startprogramm , I'm asked for a command (german Befehl) .
Which form must this command have ?
I tried: /path/autostart.sh but it did not work.
I also tried the terminal command with full path:
/root/program/bin/run program
none worked, I'm stuck :-(
|
|
1 members found this post helpful.
|
02-02-2017, 02:18 PM
|
#8
|
LQ Veteran
Registered: Jan 2011
Location: Abingdon, VA
Distribution: Catalina
Posts: 9,374
Rep:
|
Quote:
Originally Posted by jumperger
when I write ExecStartPre=run and ExecStart=program , the update checks are performend but the program does not start
|
Undo that.
in the same directory as run and program:
and see what it says.
|
|
|
02-02-2017, 02:21 PM
|
#9
|
LQ Veteran
Registered: Jan 2011
Location: Abingdon, VA
Distribution: Catalina
Posts: 9,374
Rep:
|
autostart with a .desktop file in a modern desktop is dead simple.
Drop one in or copy one to ~/.config/autostart/
This will autostart when the user logs in.
Starting a gui program via c-line presents some issues. (WON'T work via /etc/rc.local)
Can you elaborate on this Mystery program?
Last edited by Habitual; 02-02-2017 at 02:24 PM.
|
|
|
02-02-2017, 04:45 PM
|
#10
|
LQ Newbie
Registered: Oct 2016
Posts: 20
Original Poster
Rep:
|
Quote:
Originally Posted by Habitual
autostart with a .desktop file in a modern desktop is dead simple.
Drop one in or copy one to ~/.config/autostart/
|
This looks very easy, I copied my working .desktop in /home/myUser/.config/autostart but at reboot there was no program after boot.
Then I created the folder in /root/.config/autostart/ and copied my .desktop into this folder.
After reboot there was no start of the program.
doubleclicking the .desktop in the /.config/autostart starts my program , first a terminal window with the update checking, then a second window with the running program.
When quiting the program by F1, the program window closes first, then in the terminal window the shutfown of the program is notified and the terminal window closes.
|
|
|
02-02-2017, 04:52 PM
|
#11
|
LQ Newbie
Registered: Oct 2016
Posts: 20
Original Poster
Rep:
|
Quote:
Originally Posted by Habitual
Undo that.
in the same directory as run and program:
and see what it says.
|
./run and. ./run --help bring the same masseges: Checking for updates ...
and at the End it says : killed
|
|
|
02-02-2017, 05:13 PM
|
#12
|
LQ Newbie
Registered: Oct 2016
Posts: 20
Original Poster
Rep:
|
Quote:
Originally Posted by Habitual
Can you elaborate on this Mystery program?
|
The program is an emulator of the software driving a pinball machine built in 1999.
The motherboards of the machines are dieing after nearly 20 years of tough labour.
10 years ago this emulator was created, but is not supported anymore.
To use the emulator on a recent motherboard I had to get it to work on a newer linux . Now with a quad core and ssd the performance of the emulator is realy good.
Only the autostart is a problem, I have to get this to work because the LinuxPC is started at PowerOn of the pinball machine and needs to go directly into the emulator.
|
|
|
02-02-2017, 07:48 PM
|
#13
|
LQ Veteran
Registered: Jan 2011
Location: Abingdon, VA
Distribution: Catalina
Posts: 9,374
Rep:
|
Sorry, I'm stumped.
Don't fret Chet, someone will be along yet.
|
|
|
02-02-2017, 08:39 PM
|
#14
|
Senior Member
Registered: Nov 2011
Location: London, UK
Distribution: Debian
Posts: 1,950
|
Have you considered writing a simple BASH script in (There should be a number of various scripts in there already).
They get run once just after boot time, with root authority.
At least they did before the arrival of systemd - perhaps they are still run?
I deny any knowledge of systemd.
|
|
|
02-03-2017, 02:33 PM
|
#15
|
LQ Newbie
Registered: Oct 2016
Posts: 20
Original Poster
Rep:
|
Quote:
Originally Posted by JeremyBoden
Have you considered writing a simple BASH script in (There should be a number of various scripts in there already).
|
Here is my autostart.sh, doubleclicking this .sh launches the program, my .desktop file also points to this autostart.sh to launch the program.
Code:
#!/bin/bash
#export DISPLAY=:0.0
#xscreensaver-command -exit
cd /root/program/bin
./run program -window
Is this script what you consider beeing a "simple BASH script" ?
Last edited by jumperger; 02-03-2017 at 02:34 PM.
|
|
|
All times are GMT -5. The time now is 05:48 AM.
|
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.
|
Latest Threads
LQ News
|
|