Systemd, problem to start an old Program on boot under Ubuntu 16.04
Linux - NewbieThis 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.
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.
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) ?
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.
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
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?
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.
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.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.