Solved How to do matrix effect on console after booting?

Good day!

There is a port which provides matrix effect misc/termatrix. If it running by hand on a logged console all works, but I want to get it working right after booting.
I try to do that by creating /etc/rc.local
Bash:
#!/bin/sh

su username -c /usr/local/bin/termatrix &
After booting it starts to a moment and goes to background with login dialog on a static "matrixed" screen.
When I login, I see that termatrix works on background but has no screen output.
 
Yes, maybe that way, but I don't know how to convert it to be a screen saver :)

I trying various variants
  • change getty to termatrix in /etc/ttys for ttyv0 - not working
  • start throught /etc/rc.local but with sleep (for login load) - not helps
    Code:
    sleep 15 ; su username -c /usr/local/bin/termatrix &
UNIX'es have so flexibility so I hope there is any hack to do that.
 
Also, I notice that when I start termatrix throught /etc/rc.local it's output go into /var/log/messages

Folks, please your ideas!
 
Untill now I couldn't figure out either how to set up from a rc(8) script.

Another option could be to auto-login from ttyv0 into a user account, start from there termatrix.

For auto-login create a /etc/gettytab getty entry, set in /etc/ttys ttyv0 getty name, and from users .profile ( using here sh as shell ) execute termatrix. If you are interested I can provide a working example.
 
You could auto login as an unprivileged user, and then start it from ~/.login.
If you start it before the login prompt, how do you intend to log in? I don't get that part. ;D

In X, xscreensaver has a matrix theme, but it's not as pretty.
 
T-Daemon, Elazar thanks for your propositions!

I think about autologin, but if it possible to not leaving console auto-logined it will be preferred solution.
 
Finally I do as you suggested, it is awesome effect :) Either if I ran any command on that auto-logined console, output hides in matrix quickly.

Thanks!
 
If the case is having termatrix running on ttyv0 without the need of logging in ( What purpose does it serve having on ttyv0 termatrix running and logging in on another ttyv. ) , then the following solution can be used:

/usr/local/etc/rc.d/termatrix
Code:
#!/bin/sh

# PROVIDE: termatrix

. /etc/rc.subr

name=“termatrix”
start_cmd=“termatrix_start”

termatrix_start()
{
          sh -c ‘exec /usr/local/bin/termatrix <> /dev/ttyv0 >&0 2>&1’
}

load_rc_config $name
run_rc_command “$1”

chmod 555 /usr/local/etc/rc.d/termatrix

The system won’t boot to the login prompt until the termatrix script is terminated ( Ctrl + C ).
 
If the case is having termatrix running on ttyv0 without the need of logging in ( What purpose does it serve having on ttyv0 termatrix running and logging in on another ttyv. ) , then the following solution can be used:

/usr/local/etc/rc.d/termatrix
Code:
#!/bin/sh

# PROVIDE: termatrix

. /etc/rc.subr

name=“termatrix”
start_cmd=“termatrix_start”

termatrix_start()
{
          sh -c ‘exec /usr/local/bin/termatrix <> /dev/ttyv0 >&0 2>&1’
}

load_rc_config $name
run_rc_command “$1”

chmod 555 /usr/local/etc/rc.d/termatrix

The system won’t boot to the login prompt until the termatrix script is terminated ( Ctrl + C ).
Dear T-daemon:
can i hide system boot information with termatrix ? when i press Ctl+c ,the termatrix digtial rain can stop ,and prompt login console . thanks.
 
can i hide system boot information with termatrix ?
That's not possible. The systems file system (where termatrix is installed) is mounted approximately mid system boot. Until then termatrix can't be run. Even when it's possible to run it, it is of limited use.

The best you can have (on UEFI machines only) is to mute the console messages by covering them up with a splash screen [1] the first half of the boot, then run termatrix from a rc(8) script [2].

But running termatrix from a rc(8) script will not cover up boot messages, is stops the boot process, there will be no login prompt available until termatrix is ended.


[1]

Option 1 will display a black and white FreeBSD logo splash screen

/boot/loader.conf
Code:
boot_mute="YES"

Option 2, set a color FreeBSD logo, or custom image

/boot/loader.conf
Code:
boot_mute="YES"
splash="/boot/images/freebsd-logo-rev.png"
For a custom splash (a picture or solid color image) replace freebsd-logo-rev.png. The image must be PNG, the pixel format 8bpc RGBA, and the size not larger than the efi framebuffer screen resolution.

[2]
Code:
#!/bin/sh

# PROVIDE: termatrix
# REQUIRE: FILESYSTEMS

# Add the following to /etc/rc.conf to enable this service
#
# termatrix_enable (bool): Set to "NO" by default.
#               Set it to "YES" to enable termatrix.

. /etc/rc.subr

name=termatrix
rcvar=termatrix_enable
start_cmd=termatrix_start

: ${termatrix_enable="NO"}

termatrix_start()
{
        sh -c 'exec /usr/local/bin/termatrix <> /dev/ttyv0 >&0 2>&1'
}

load_rc_config $name
run_rc_command "$1"
 
That's not possible. The systems file system (where termatrix is installed) is mounted approximately mid system boot. Until then termatrix can't be run. Even when it's possible to run it, it is of limited use.

The best you can have (on UEFI machines only) is to mute the console messages by covering them up with a splash screen [1] the first half of the boot, then run termatrix from a rc(8) script [2].

But running termatrix from a rc(8) script will not cover up boot messages, is stops the boot process, there will be no login prompt available until termatrix is ended.


[1]

Option 1 will display a black and white FreeBSD logo splash screen

/boot/loader.conf
Code:
boot_mute="YES"

Option 2, set a color FreeBSD logo, or custom image

/boot/loader.conf
Code:
boot_mute="YES"
splash="/boot/images/freebsd-logo-rev.png"
For a custom splash (a picture or solid color image) replace freebsd-logo-rev.png. The image must be PNG, the pixel format 8bpc RGBA, and the size not larger than the efi framebuffer screen resolution.

[2]
Code:
#!/bin/sh

# PROVIDE: termatrix
# REQUIRE: FILESYSTEMS

# Add the following to /etc/rc.conf to enable this service
#
# termatrix_enable (bool): Set to "NO" by default.
#               Set it to "YES" to enable termatrix.

. /etc/rc.subr

name=termatrix
rcvar=termatrix_enable
start_cmd=termatrix_start

: ${termatrix_enable="NO"}

termatrix_start()
{
        sh -c 'exec /usr/local/bin/termatrix <> /dev/ttyv0 >&0 2>&1'
}

load_rc_config $name
run_rc_command "$1"
Dear T-daemon:
i have read your service code about termatrix. could you explain below code detail for me ? thanks.

#sh -c 'exec /usr/local/bin/termatrix <> /dev/ttyv0 >&0 2>&1'

sh -c #what command is it ?
<> #what is it ? pipe ? what mean ?
>&0 #what is it ? what mean ?
2>&1 #what is it ? what mean ?

thanks very much.
 
Back
Top