0

I cam currently building a miniroot with an Ubuntu 15.10 base. Therefore I want to use systemd. My standard script '/etc/init.d/script' is found and executed by systemd. However I also do have a conf for this script located at /etc/init/script.conf is not executed. Therefore I write this systemd script

[Unit]
Description=Job that starts the startmaster.sh in /usr/bin/local/
Requires=script.service
After=script.service

[Service]
Type=forking
ExecStart=/sbin/getty -l /usr/local/bin/startmaster.sh -n 38400 tty6

[Install]
WantedBy=multi-user.target

this script is executed on boot, but it does not show the expected behaviour

content of startmaster.py #!/bin/sh

PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin

#vt=$1
vt=6


sleep 1
chvt $vt
sleep 1
chvt $vt
sleep 1
chvt $vt

screen -U master.py

exec getty 38400 tty$vt

dmesg shows the following segfault

[ 2106.122116] master.py[3960]: segfault at 0 ip 00007f731ccfa892 sp 00007ffdb76d5620 error 4 in libc-2.21.so[7f731cc76000+1c0000]

any suggestions how to fix this

user3694354
  • 105
  • 8

1 Answers1

1

I'm not sure why you need the getty and vt complexity. Does master.py require human input? Why no just run master.py directly from the systemd unit? If you need to monitor it, you can do that by viewing the output from master.py by running journalctl -u master.service.

This is much simpler. Please try it and see if it suites your needs

[Unit]
Description=Master service that does xyz

[Service]
Type=simple
ExecStart=/usr/local/master.py

[Install]
WantedBy=multi-user.target
Gary van der Merwe
  • 9,134
  • 3
  • 49
  • 80
  • in case some infos are not given the user need to complete them, therefore I need the human interaction. – user3694354 Jan 13 '16 at 15:16
  • I tried it your way and got the following error.... master.py[3847]: TERM environment variable needs set....Failed with result'exit'code' – user3694354 Jan 13 '16 at 15:33