systemd/Services - ArchWiki

# systemd/Services

This article or section is being considered for deletion.

Reason: Please do not add any new elements to this page. All services must/will be relocated on their dedicated corresponding main article. (Discuss)

Related articles

- systemd
- systemd/User
- systemd FAQ
- Daemons List

This page is useful to publish systemd service files that are missing in the appropriate package in the official repositories or the AUR. These files can be copied from other distributions or created by yourself.

## Xvfb

Change the `User=` and `Group=` parameters:

    /etc/systemd/system/xinit.service

    [Unit]
    Description=xinit with xvfb
    After=network.target

    [Service]
    User=bitlbee
    Group=bitlbee
    ExecStart=/usr/bin/xvfb-run bash %h/.xinitrc

    [Install]
    WantedBy=multi-user.target

## slock

Locks the system with the help of slock. Very handy when closing the laptop lid for example.

    /etc/systemd/system/screenlock.service

    [Unit]
    Description=Lock X session using slock
    Before=sleep.target

    [Service]
    User=<username>
    Environment=DISPLAY=:0
    ExecStart=/usr/bin/slock

    [Install]
    WantedBy=sleep.target

## xautolock

Automatically lock the screen after a timeout of 10 minutes.

    /etc/systemd/system/xautolock.service

    [Unit]
    Description=Lock the screen automatically after a timeout

    [Service]
    Type=simple
    User=<username>
    Environment=DISPLAY=:0
    ExecStart=/usr/bin/xautolock -time 10 -locker slock -detectsleep

    [Install]
    WantedBy=graphical.target

## ncdc

    /etc/systemd/system/ncdc@.service

    [Unit]
    Description=ncdc
    Requires=network.target local-fs.target

    [Service]
    Type=oneshot
    RemainAfterExit=yes
    KillMode=none
    User=%I
    ExecStart=/usr/bin/tmux new-session -s dcpp -n ncdc -d ncdc
    ExecStop=/usr/bin/tmux send-keys -t dcpp:ncdc "/quit" C-m

    [Install]
    WantedBy=multi-user.target

## Squeezelite

    /etc/conf.d/squeezelite

    server="<server>:<port>"   # amend as appropriate
    name="<device_name>"       # amend as appropriate
    mac="<your_mac_here>"      # amend as appropriate
    device="default"           # amend as appropriate
    logtype="all"
    loglevel="info"
    logfile="/var/log/squeezelite.log"

    /etc/systemd/system/squeezelite.service

    [Unit]
    Description=Squeezelite Service
    After=network.target

    [Service]
    Type=simple
    EnvironmentFile=/etc/conf.d/squeezelite
    ExecStart=/usr/bin/squeezelite -n ${name} -m ${mac} -d ${logtype}=${loglevel} -f ${logfile} -o ${device} -s ${server}
    RestartSec=5
    Restart=on-failure

    [Install]
    WantedBy=multi-user.target

## See also

- Backing up local pacman database with systemd

Categories:

- Daemons and system services
- Boot process