You can refer to the article: https://www.cnblogs.com/jmliao/p/11823209.html
Specific Case Study:
# In the root user directly with the following command to execute the program, the program is executed, the program is part of the user git
su - git -c "nohup /home/git/gogs/gogs web >/dev/null 2>&1 &"