Systemd is a system and service manager for Linux operating systems. It is used to manage and control services, manage system startup and shutdown, and perform various system-related tasks.

Here is the sample configure for the systemd service. /etc/systemd/system/tightvncserverdemo2.service

[Unit]
Description=TightVNC Server
After=network.target

[Service]
Type=forking
User=demo
#ExecStart=/usr/bin/vncserver :88 -geometry 1280x720
ExecStart=/usr/bin/vncserver -geometry 1280x720 :89
ExecStop=/usr/bin/vncserver -kill :89

[Install]
WantedBy=multi-user.target

After configuring the service file. We will need to reload the systemd daemon

sudo systemctl daemon-reload

Next we will enable the service.

sudo systemctl enable tightvncserverdemo2.service  

We can now start the service.

sudo systemctl start tightvncserverdemo2.service  

We can verify the service is start by issuing

sudo systemctl status tightvncserverdemo2.service

Below is a sample of the output of the status

-(demo@poc)---[~]
-$ sudo systemctl status tightvncserverdemo2.service 
● tightvncserverdemo2.service - TightVNC Server on port 5990
     Loaded: loaded (/etc/systemd/system/tightvncserverdemo2.service; enabled; vendor preset: enabled)
     Active: active (running) since Sat 2023-10-21 15:20:39 CEST; 8min ago
    Process: 1137 ExecStart=/usr/bin/vncserver -geometry 1280x720 :90 (code=exited, status=0/SUCCESS)
      Tasks: 81 (limit: 309297)
     Memory: 187.3M
        CPU: 6.893s
     CGroup: /system.slice/tightvncserverdemo2.service
             ├─1293 Xtightvnc :90 -desktop X -auth /home/demo/.Xauthority -geometry 1280x720 -depth 24 -rfbwait 120000 -rfbauth /home/demo/.vnc/passwd -rfbport 5990 -fp /usr/share/fonts/X11/misc/,/usr/share/fonts/X11/Type1/>
             ├─1404 xfce4-session
             ├─1439 /usr/bin/dbus-launch --sh-syntax --exit-with-session xfce4-session
             ├─1464 /usr/bin/dbus-daemon --syslog --fork --print-pid 5 --print-address 7 --session
             ├─1473 /usr/libexec/at-spi-bus-launcher
             ├─1482 /usr/bin/dbus-daemon --config-file=/usr/share/defaults/at-spi2/accessibility.conf --nofork --print-address 11 --address=unix:path=/home/demo/.cache/at-spi/bus_90
             ├─1501 /usr/lib/x86_64-linux-gnu/xfce4/xfconf/xfconfd
             ├─1511 /usr/libexec/at-spi2-registryd --use-gnome-session
             ├─1522 /usr/bin/xfce4-screensaver
             ├─1553 /usr/libexec/gvfsd
             ├─1579 /usr/bin/ssh-agent -s
             ├─1589 /usr/bin/gpg-agent --sh --daemon
             ├─1592 xfwm4
             ├─1612 xfsettingsd
             ├─1625 xfce4-panel
             ├─1632 Thunar --daemon
             ├─1647 xfdesktop
             ├─1655 /usr/lib/x86_64-linux-gnu/xfce4/notifyd/xfce4-notifyd
             ├─1694 xfce4-power-manager
             ├─1738 /usr/libexec/gvfs-udisks2-volume-monitor
             ├─1877 /usr/libexec/gvfsd-trash --spawner :1.7 /org/gtk/gvfs/exec_spaw/0
             ├─1938 /usr/libexec/gvfsd-metadata
             ├─1982 /usr/lib/x86_64-linux-gnu/xfce4/panel/wrapper-2.0 /usr/lib/x86_64-linux-gnu/xfce4/panel/plugins/libsystray.so 6 37748746 systray "Status Tray Plugin" "Provides status notifier items (application indicato>
             ├─1985 /usr/lib/x86_64-linux-gnu/xfce4/panel/wrapper-2.0 /usr/lib/x86_64-linux-gnu/xfce4/panel/plugins/libpulseaudio-plugin.so 8 37748747 pulseaudio "PulseAudio Plugin" "Adjust the audio volume of the PulseAudi>
             ├─1988 /usr/lib/x86_64-linux-gnu/xfce4/panel/wrapper-2.0 /usr/lib/x86_64-linux-gnu/xfce4/panel/plugins/libxfce4powermanager.so 9 37748748 power-manager-plugin "Power Manager Plugin" "Display the battery levels >
             ├─1989 /usr/lib/x86_64-linux-gnu/xfce4/panel/wrapper-2.0 /usr/lib/x86_64-linux-gnu/xfce4/panel/plugins/libnotification-plugin.so 10 37748749 notification-plugin "Notification Plugin" "Notification plugin for th>
             ├─2014 /usr/lib/x86_64-linux-gnu/xfce4/panel/wrapper-2.0 /usr/lib/x86_64-linux-gnu/xfce4/panel/plugins/libactions.so 14 37748750 actions "Action Buttons" "Log out, lock or other system actions"
             ├─2149 /usr/bin/python3 /usr/bin/gnome-terminal --wait
             ├─2150 /usr/bin/gnome-terminal.real --wait
             ├─2154 /usr/libexec/gnome-terminal-server
             └─2185 bash