systemd管理开机自启动

Using a separate service
Tip: These steps can be automated by installing the systemd-numlockonttyAUR package and enabling the numLockOnTty service.

First create a script to set the numlock on relevant TTYs:

/usr/local/bin/numlock

#!/bin/bash

for tty in /dev/tty{1..6}
do
    /usr/bin/setleds -D +num < "$tty";
done

Once the script is created, you will need to make it executable. Otherwise the script cannot run.

Then create and enable a systemd service:

/etc/systemd/system/numlock.service

[Unit]
Description=numlock

[Service]
ExecStart=/usr/local/bin/numlock
StandardInput=tty
RemainAfterExit=yes

[Install]
WantedBy=multi-user.target
posted @ 2020-06-29 10:13  刘大侠GG_B  阅读(388)  评论(0编辑  收藏  举报