LinuxQuestions.org
Help answer threads with 0 replies.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
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


Reply
  Search this Thread
Old 02-01-2017, 12:47 PM   #1
jumperger
LQ Newbie
 
Registered: Oct 2016
Posts: 20

Rep: Reputation: Disabled
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 12:53 PM.
 
Old 02-01-2017, 03:56 PM   #2
Ztcoracat
LQ Guru
 
Registered: Dec 2011
Distribution: Slackware, MX 18
Posts: 9,484
Blog Entries: 15

Rep: Reputation: 1174Reputation: 1174Reputation: 1174Reputation: 1174Reputation: 1174Reputation: 1174Reputation: 1174Reputation: 1174Reputation: 1174
Quote:
The only thing left, is to start the program automatically after the booting of my linux PC.
I'm not sure how you would configure that to start at boot time but other's here might.

--Maybe these links about systctl hall of tips and systemd will help.--

https://access.redhat.com/documentat...nit_Files.html

http://cavepopo.hd.free.fr/wordpress...ips-systemctl/

Good Luck-
 
Old 02-01-2017, 05:35 PM   #3
toothandnail
Member
 
Registered: Apr 2007
Location: Oxfordshire, UK
Distribution: Arch, Sparky, Salix64
Posts: 117

Rep: Reputation: 23
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.
 
Old 02-01-2017, 10:01 PM   #4
jumperger
LQ Newbie
 
Registered: Oct 2016
Posts: 20

Original Poster
Rep: Reputation: Disabled
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
 
Old 02-01-2017, 10:46 PM   #5
hydrurga
LQ Guru
 
Registered: Nov 2008
Location: Pictland
Distribution: Linux Mint 20 MATE
Posts: 8,048
Blog Entries: 5

Rep: Reputation: 2918Reputation: 2918Reputation: 2918Reputation: 2918Reputation: 2918Reputation: 2918Reputation: 2918Reputation: 2918Reputation: 2918Reputation: 2918Reputation: 2918
If startup on login will suffice: https://help.ubuntu.com/16.04/ubuntu...lications.html
 
Old 02-02-2017, 10:34 AM   #6
jumperger
LQ Newbie
 
Registered: Oct 2016
Posts: 20

Original Poster
Rep: Reputation: Disabled
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.
Old 02-02-2017, 12:14 PM   #7
Ztcoracat
LQ Guru
 
Registered: Dec 2011
Distribution: Slackware, MX 18
Posts: 9,484
Blog Entries: 15

Rep: Reputation: 1174Reputation: 1174Reputation: 1174Reputation: 1174Reputation: 1174Reputation: 1174Reputation: 1174Reputation: 1174Reputation: 1174
Quote:
Thank's for the links,
these were the pages I mainly used to dig into systemd
You're Welcome.

Quote:
Which form must this command have ?
I honestly don't know.
Try these articles. It looks like a start.

http://www.makeuseof.com/tag/start-a...y-linux-boots/
https://docs.oseems.com/general/oper...ram-on-startup

How to start a program or script at boot time
http://cosmolinux.no-ip.org/raconetlinux2/boot.html

If that doesn't work look in my LQ blog. I wrote an article for a Desktop Entry that might help.
 
Old 02-02-2017, 01:18 PM   #8
Habitual
LQ Veteran
 
Registered: Jan 2011
Location: Abingdon, VA
Distribution: Catalina
Posts: 9,374
Blog Entries: 37

Rep: Reputation: Disabled
Quote:
Originally Posted by jumperger View Post
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:
Code:
./run --help
and see what it says.
 
Old 02-02-2017, 01:21 PM   #9
Habitual
LQ Veteran
 
Registered: Jan 2011
Location: Abingdon, VA
Distribution: Catalina
Posts: 9,374
Blog Entries: 37

Rep: Reputation: Disabled
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 01:24 PM.
 
Old 02-02-2017, 03:45 PM   #10
jumperger
LQ Newbie
 
Registered: Oct 2016
Posts: 20

Original Poster
Rep: Reputation: Disabled
Quote:
Originally Posted by Habitual View Post
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.
 
Old 02-02-2017, 03:52 PM   #11
jumperger
LQ Newbie
 
Registered: Oct 2016
Posts: 20

Original Poster
Rep: Reputation: Disabled
Quote:
Originally Posted by Habitual View Post
Undo that.

in the same directory as run and program:
Code:
./run --help
and see what it says.
./run and. ./run --help bring the same masseges: Checking for updates ...
and at the End it says : killed
 
Old 02-02-2017, 04:13 PM   #12
jumperger
LQ Newbie
 
Registered: Oct 2016
Posts: 20

Original Poster
Rep: Reputation: Disabled
Quote:
Originally Posted by Habitual View Post
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.
 
Old 02-02-2017, 06:48 PM   #13
Habitual
LQ Veteran
 
Registered: Jan 2011
Location: Abingdon, VA
Distribution: Catalina
Posts: 9,374
Blog Entries: 37

Rep: Reputation: Disabled
Sorry, I'm stumped.

Don't fret Chet, someone will be along yet.
 
Old 02-02-2017, 07:39 PM   #14
JeremyBoden
Senior Member
 
Registered: Nov 2011
Location: London, UK
Distribution: Debian
Posts: 1,895

Rep: Reputation: 469Reputation: 469Reputation: 469Reputation: 469Reputation: 469
Have you considered writing a simple BASH script in
Code:
/etc/cron.daily
(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.
 
Old 02-03-2017, 01:33 PM   #15
jumperger
LQ Newbie
 
Registered: Oct 2016
Posts: 20

Original Poster
Rep: Reputation: Disabled
Quote:
Originally Posted by JeremyBoden View Post
Have you considered writing a simple BASH script in
Code:
/etc/cron.daily
(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 01:34 PM.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
[SOLVED] systemd[1]: Failed to start OpenBSD Secure Shell server during boot pan64 Linux - General 14 10-31-2015 05:14 AM
[SOLVED] Centos 7 - how to start Java app requiring networking on boot with systemd rylan76 Linux - Server 3 06-26-2015 03:30 AM
Boot Delay 30min: systemd-analyze blame systemd-tmpfiles-setup.service BGHolmes Fedora 0 07-27-2011 09:02 AM
[SOLVED] Newbie problem getting Ubuntu s/w to start on triple boot Acer Aspire One netbook meggiedude Linux - Newbie 17 05-19-2011 01:39 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 04:51 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration