'systemctl command not recognized when building RPM package?

I have a very small pre install script for the RPM generation in VS consisting of:

            <![CDATA[
           #the bash preinst script
           sudo systemctl stop serviceName
        ]]>

and I receive back error

command not found
Invalid unit name "serviceName
" escaped as "serviceName\x0d" (maybe you should use systemd-escape?).
Failed to stop serviceName\x0d.service: Unit serviceName\x0d.service not loaded.

I am not sure what to make of the above. It appears when installing the rpm on my vm. Is the command working as it should but complaining about some type of special character in my service name? All the script does is stop any existing instances of the serviceName running on the vm.



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source