how to write a script file for boot up?

Hi All

Any one have any good site or key words to search for to foster the concept of writting script files for start up?

Wish to do auto login as “root” and run some of the application written by user.


If you want to auto-login as root when QNX boots modify the file /etc/config/ttys

In there you’ll see 4 lines that look like:

con1 “/bin/login” qansi-m on
con2 “/bin/login” qansi-m on
con3 “/bin/login” qansi-m on
con4 “/bin/login” qansi-m on

Modify the first one to be:

con1 “/bin/login -f root” qansi-m on

This forces a root login at start time.

Then in the /root directory there is a profile file called ‘.profile’

This file gets executed when root logs in. You can place your script stuff in here to start your application or simply add a call to another script file that starts everything (I prefer the writing a 2nd script file and calling it from the .profile file)

There are other ways to accomplish what you want but this is one easy way.


If you want to auto-login as root when QNX boots modify the file /etc/config/ttys
con1 “/bin/login -f root” qansi-m on
This forces a root login at start time.

it doesn’t work for me :frowning:.
/normal login screen appears;


Have you created a custom boot image or anything like that?

Normally at the end of /etc/rc.d/rc.sysinit there is a line which invokes ‘tinit’ which reads the ttys file for startup instructions which should then auto login you in as root on console 1.

Can you confirm that you do not have a custom image and that you have the rc.sysinit file with the tinit call in it at the end of the file.


Thanks for the reply Tim , but it does not work for mee too, please advice

Just wondering where could i find reading material for all this?
and how to create a callable script?


No, I don’t have ‘tinit’ at the end of my rc.sysinit.

I’ve added ‘tinit’ line in rc.local
and autologin to console works,
but immediately after login to console
appears photon login screen.

How to autologin to photon (as a root) ?


Ah, I didn’t know you wanted to auto-login to photon. I gave the method to auto-login to console mode (normally what you have when you deploy a system in embedded mode with no keyboard/mouse/monitor).

Looking very briefly at the photon doc’s (lookup ‘ph’ in the helpviewer) it looks like all you need to do is set the LOGNAME environment variable to root in the sysinit file and then photon will auto-login as that name.

Ie in your sysinit file (or rc.sysinit) do:


Warning Warning. Once you do this, you’ll always boot logged in a root in photon so no password will be needed. Just be aware of that.

So you can take out the tinit stuff in your rc.sysinit file since you just want a photon auto-login.


Are you also wanting to auto-login to photon or in console mode? If you want to auto-login to photon see the above info. If console mode, you will need the tinit stuff to auto-login in console mode.

As for reading material, it’s all in the helpviewer or search around on this site.

Look up ‘tinit’, ‘ph’ for auto-logging in to photon or console mode.

Look up ‘.profile’ (the dot is deliberate) to get info on auto starting user applications at login time. Everything will go into that file.

Look up ‘scripts’ for help on writing script files. Esp the ‘Writing Shell Scripts’ link that gets returned when you seach for ‘scripts’. Basically, a script is just a text file of commands with the execute bit set.


For start-up photon perform follow step:

  1. in the file /etc/rc.d/rc.sysinit change string from <P=-p> to <#P=-p>
  2. in the file /etc/config/ttys change string from <con1 “/bin/loginâ€

Hi All
what is the “clean” way to re-spawn (like in linux inittab) login utility.
I want to be able to login/logout as many times as needed (indefinitely) through the serial console.

PS I have tried adding multiple lines of

[+session] login

to the end of my .build script. It works fine. But I can not add “indefinite” number of lines …


wrote and tested a binary, which spawns “login” from an indefinite loop. Then I added the binary at the end of .build script. Seems to be ok, but I am still wondering what is the “professional” way of doing this under QNX …

Check out tinit.

Thanks, thats what I need.