I got a bash script essentially runnning this:#!/bin/bash[...] while true; do         str=broadcast `randArrayElement messages[@]`         server_send_message $str         sleep $interval doneNow I want to run this as a systemd service, my service script looks like this:[Unit]Description=AnnouncerAfter=network.target[Service]ExecStart=/usr/local/bin/somescript &; disownExecStop=/usr/bin/kill -9 `cat /tmp/somescript.pid`Type=forkingPIDFile=/tmp/somescript.pid[Install]WantedBy=default.targetUnfortunately when I run this service via service somescript start it is working but because of the while true loop my terminal is stuck in starting the script: somescript.service - somescript service   Loaded: loaded (/etc/systemd/system/somescript.service; disabled; vendor preset: enabled)   Active: activating (start) since Wed 2016-08-17 12:22:34 CEST; 43s ago  Control: 17395 (somescript)   CGroup: /system.slice/somescript.service           17395 /bin/bash /usr/local/bin/somescript &; disown           17409 sleep 600How can I run this script as a service without being stuck in starting /  the while true loop?
Run while true in systemd script
bash;shell script;systemd
You need to let systemd work for you.  Let it handle the forking at the start and the killing of the process.  Eg replace your service part by[Service]Type=simpleExecStart=/usr/local/bin/somescriptPIDFile=/tmp/somescript.pidthen you can use systemctl start, status and stop. You must remember that the lines in systemd are NOT interpreted by the shell, so for example your &; is merely passed as another parameter of 2 characters to your script.