I use xinit to start X with wm - startx command that using .xinitrc to invoke X11 environment, but when X starts, there a black screen with cursor staying there for few seconds before X is fully started and if I press ctrl-c to interrupt the process, it will drop to shell, meaning user always has a way to go into shell - how to disable this ability?
1 Answer
The issue here is that you're calling startx in the foreground. If you want it to run in the background and not be susceptible to ctrl-c then append & at the end of the command.
For example:
sleep 3s && echo 1
This command will sleep for three seconds and then echo 1 to standard output. As it is in the foreground, you can interrupt it with ctrl-c.
Alternatively, you can continue to work on other things in the foreground while it runs in the background until either you log out or it terminates:
sleep 3s && echo 1 &
See here for more examples:
https://www.cyberciti.biz/faq/unix-linux-jobs-command-examples-usage-syntax/
If you are just running startx then try replacing it with startx &.
wm - startx &to run it as a background task?.profiletostartx, what's difference with your command? I'll try and give feedback.