1

In Slackware I just change one line in initab to run my program in a different console on bootup with auto respawn, how can I accomplish this in Ubuntu .. it seem one need a phd to write a upstart file in /etc/init/myprogram

c2:1235:respawn:/home/gerrie/myprogram 1<&2 1>/dev/tty2 <dev/tty2

Thanks in advance

  • Please, explain what are you trying to achieve. As it is, your question is unclear. Also read the Upstart cookbook to inform yourself about Upstart. – edwin Apr 11 '14 at 19:40
  • Is the file named /etc/init/myprogram? If so, it needs to have a .conf suffix. – CameronNemo Jun 2 '14 at 16:53
  • Good to know that I'm not the only one struggling with upstart. It looks really complicated. – Sridhar Sarnobat Jul 26 '17 at 5:21
0

Just adapt one of the existing jobs:

# tty1 - getty
#
# This service maintains a getty on tty1 from the point the system is
# started until it is shut down again.

start on stopped rc RUNLEVEL=[2345] and (
            not-container or
            container CONTAINER=lxc or
            container CONTAINER=lxc-libvirt)

stop on runlevel [!2345]

respawn
exec /sbin/getty -8 38400 tty1

You probably want to make it look something like this:

# tty2myprogram - myprogram
#
# This service maintains a getty on tty2 from the point the system is
# started until it is shut down again.

start on stopped rc RUNLEVEL=[2345] and (
            not-container or
            container CONTAINER=lxc or
            container CONTAINER=lxc-libvirt)

stop on runlevel [!2345]

respawn
exec /sbin/getty -8 38400 -l /home/gerrie/myprogram tty2

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.