# Auto-run process doesn't allow to login



## Undland (Jan 10, 2017)

I has created startup script of launching java application. When OS is loading this app occupies the terminal and doesn't allow to login. I cant use OS after that. Alt+f1-8 doesn't work.
I have a FreeBSD 11 only with root user and I don't need ssh access. Starting app as a daemon is not good enough for me because I need to see its processing progress.

Is there a way to log in or open virtual terminal after starting the script?


----------



## leebrown66 (Jan 10, 2017)

Why can't you daemonize and redirect the output to a file?

Alternatively, `rcorder /etc/rc.d/* /usr/local/etc/rc.d/*`
Will tell you the order those scripts are run in.  I'd wager you want to move yours to the end.  However if it's blocking I'm not sure how far you'll get.


----------



## aribi (Jan 10, 2017)

Don't know how your script works, but a nice way is folding your startup into autologin.
This was described in, for example, in https://lists.freebsd.org/pipermail/freebsd-questions/2009-October/206295.html
If you change the line in /etc/ttys for ttyv7 your prog will start in the background and you can switch on your console to the running prog with ALT-F8.
I would suggest creating a specific user (javadude) with exactly enough permissions to run your java app and let it start your java-app through its .login or .profile.
To make this start automatically add this line to /etc/ttys

```
ttyv7   "/usr/libexec/getty al.javadude"       xterm   on  insecure
```
and these two lines to /etc/gettytab

```
al.javadude:\
   :al=javadude:tc=Pc
```
Make the changes active via `kill -HUP 1` alerting init process to the config change. Or simply through reboot.
At the console hit ALT-F8 and you'll see your prog running. ALT-F1 should get you back.


----------



## Undland (Jan 10, 2017)

leebrown66 said:


> Why can't you daemonize and redirect the output to a file?
> 
> Alternatively, `rcorder /etc/rc.d/* /usr/local/etc/rc.d/*`
> Will tell you the order those scripts are run in.  I'd wager you want to move yours to the end.  However if it's blocking I'm not sure how far you'll get.


I don't understand what has order of scripts execution to do with it. The server works independently and after losing power it returns to online. Sometimes i need to check application process. But if app is a daemon i cant do it. If not a daemon, then i cant login and do anything excepting app check.


----------



## leebrown66 (Jan 11, 2017)

Well if your script runs before whatever sets up the terminal handling for ALT-F1, etc., and never exits, then that's why the order could be important.
(you are talking about an /etc/rc.d script here right?)


----------

