# systemd/Services

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.

## tpfand

    /etc/systemd/system/tpfand.service

    [Unit]
    Description=ThinkPad Fan Control

    [Service]
    Type=forking
    PIDFile=/var/run/tpfand.pid
    ExecStart=/usr/sbin/tpfand

    [Install]
    WantedBy=multi-user.target

## VideoLAN 2.0

Change the `User=` parameter.

    /etc/systemd/system/vlc.service

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

    [Service]
    Type=forking
    User=nobody
    ExecStart=/usr/bin/cvlc --intf=lua --lua-intf=http --daemon --http-port 8090
    Restart=on-abort

    [Install]
    WantedBy=multi-user.target

## 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

## Cisco AnyConnect VPN

    /etc/systemd/system/ciscovpn.service

    [Unit]
    Description=Cisco AnyConnect Secure Mobility Client Agent
    Requires=network.target remote-fs.target
    After=network.target remote-fs.target

    [Service]
    Type=forking
    PIDFile=/var/run/vpnagentd.pid
    ExecStart=/opt/cisco/anyconnect/bin/vpnagentd
    ExecStop=/usr/bin/killall /opt/cisco/anyconnect/bin/vpnagentd
    Restart=on-abort

    [Install]
    # one may want to use multi-user.target instead
    WantedBy=graphical.target

## Turn off the automatic screensaver

Arch Linux has a 10 minute screensaver set as standard. XBMC for CuBox does not disable this when watching movies, and this is a rather hackish workaround. Tested on the CuBox.

    /etc/systemd/system/screensaveroff.service

    [Unit]
    Description=Disables the screensaver in X
    After=graphical.target

    [Service]
    Type=oneshot
    RemainAfterExit=yes
    ExecStart=/usr/bin/xset s off -d :0

    [Install]
    WantedBy=graphical.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

## VDE2 interface

Create and activate a vde2 tap interface for use in the `users` user group.

    /etc/systemd/system/vde2@.service

    [Unit]
    Description=Network Connectivity for %i
    Wants=network.target
    Before=network.target

    [Service]
    Type=oneshot
    RemainAfterExit=yes
    ExecStart=/usr/bin/vde_switch -tap %i -daemon -mod 660 -group users
    ExecStart=/usr/bin/ip link set dev %i up
    ExecStop=/usr/bin/ip addr flush dev %i
    ExecStop=/usr/bin/ip link set dev %i down

    [Install]
    WantedBy=multi-user.target

## Crashplan PROe server

    /etc/systemd/system/proserver.service

    [Unit]
    Description=CrashPlanPROe Backup Server
    After=network.target

    [Service]

    Type=forking

    ExecStart=/opt/proserver/bin/proserver start
    ExecStop=/opt/proserver/bin/proserver stop

    [Install]
    WantedBy=multi-user.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

## freeswitch

    /etc/systemd/system/freeswitch.service

    [Unit]
    Description=freeswitch
    After=syslog.target network.target local-fs.target

    [Service]
    Type=forking
    PIDFile=/run/freeswitch/freeswitch.pid
    EnvironmentFile=/etc/conf.d/freeswitch
    PermissionsStartOnly=true
    ExecStartPre=/bin/mkdir -p /run/freeswitch
    ExecStartPre=/bin/chown freeswitch:freeswitch /run/freeswitch
    ExecStart=/usr/bin/freeswitch $FREESWITCH_OPTS
    TimeoutSec=45s
    Restart=always
    User=freeswitch
    Group=freeswitch
    UMask=0007

    [Install]
    WantedBy=multi-user.target

    /etc/conf.d/freeswitch

    # options to start freeswitch with
    # We default to -nonat, if you need nat, remove it
    FREESWITCH_OPTS="-nc"

## See also

- Backing up local pacman database with systemd

Categories:

- Daemons and system services
- Boot process