P
P
pcdesign2016-01-24 12:10:52
CentOS
pcdesign, 2016-01-24 12:10:52

How to start systemd if the username is "217"?

Created user jasttest. In his home folder /home/jasttest/www/ put two files:

# main.py
from flask import Flask
app = Flask(__name__)

@app.route('/')
def hello_world():
    return 'Hello World!'

if __name__ == '__main__':
    app.run()


And

# webserver.sh
#!/bin/bash

HOME=/home/jasttest
VENVDIR=$HOME/env/bin
BINDIR=$HOME/www

cd $BINDIR
source $VENVDIR/activate
/home/jasttest/env/bin/gunicorn  -b localhost:8001  main:app


And in the /usr/lib/systemd/system folder I put the file from the root:
[Unit]
Description=W2 Web App gunicorn
After=network.target

[Service]
Type=simple
User=jasttest
Group=jasttest
ExecStart=/home/jasttest/www/webserver.sh

[Install]
WantedBy=multi-user.target


And everything works great.
The daemon is starting. Responds to port 8001.

I do everything one to one, but this time the user is not jasttest, but 217.

And nothing works.

systemctl status gunicorn.service         
? gunicorn.service - Web App gunicorn
   Loaded: loaded (/usr/lib/systemd/system/gunicorn.service; enabled; vendor preset: disabled)
   Active: failed (Result: exit-code) since Sun 2016-01-24 12:04:35 MSK; 9s ago
  Process: 3347 ExecStart=/home/217/www/webserver.sh (code=exited, status=217/USER)
 Main PID: 3347 (code=exited, status=217/USER)

Jan 24 12:04:35 new217.localdomain systemd[1]: Started Web App gunicorn.
Jan 24 12:04:35 new217.localdomain systemd[1]: Starting Web App gunicorn...
Jan 24 12:04:35 new217.localdomain systemd[1]: gunicorn.service: main process exited, code=exited, status=217/USER
Jan 24 12:04:35 new217.localdomain systemd[1]: Unit gunicorn.service entered failed state.
Jan 24 12:04:35 new217.localdomain systemd[1]: gunicorn.service failed.
[[email protected] system]# 
[[email protected] system]# 
[[email protected] system]# 
[[email protected] system]# journalctl -xn
-- Logs begin at Sun 2016-01-24 10:27:06 MSK, end at Sun 2016-01-24 12:04:35 MSK. --
Jan 24 12:01:01 new217.localdomain run-parts(/etc/cron.hourly)[3331]: starting 0yum-hourly.cron
Jan 24 12:01:01 new217.localdomain run-parts(/etc/cron.hourly)[3335]: finished 0yum-hourly.cron
Jan 24 12:04:35 new217.localdomain polkitd[634]: Registered Authentication Agent for unix-process:3342:585028 (system bus name :1.59 [/usr/bin/pkttyagent --notify-fd 5 --fallback], object p
Jan 24 12:04:35 new217.localdomain systemd[1]: Started Web App gunicorn.
-- Subject: Unit gunicorn.service has finished start-up
-- Defined-By: systemd
-- Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel
-- 
-- Unit gunicorn.service has finished starting up.
-- 
-- The start-up result is done.
Jan 24 12:04:35 new217.localdomain systemd[1]: Starting Web App gunicorn...
-- Subject: Unit gunicorn.service has begun start-up
-- Defined-By: systemd
-- Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel
-- 
-- Unit gunicorn.service has begun starting up.
Jan 24 12:04:35 new217.localdomain systemd[3347]: Failed at step USER spawning /home/217/www/webserver.sh: No such process
-- Subject: Process /home/217/www/webserver.sh could not be executed
-- Defined-By: systemd
-- Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel
-- 
-- The process /home/217/www/webserver.sh could not be executed and failed.
-- 
-- The error number returned by this process is 3.
Jan 24 12:04:35 new217.localdomain systemd[1]: gunicorn.service: main process exited, code=exited, status=217/USER
Jan 24 12:04:35 new217.localdomain systemd[1]: Unit gunicorn.service entered failed state.
Jan 24 12:04:35 new217.localdomain systemd[1]: gunicorn.service failed.
Jan 24 12:04:35 new217.localdomain polkitd[634]: Unregistered Authentication Agent for unix-process:3342:585028 (system bus name :1.59, object path /org/freedesktop/PolicyKit1/Authenticatio
[[email protected] system]#


What kind of joke is this related to the user's name?

Answer the question

In order to leave comments, you need to log in

[[+comments_count]] answer(s)
S
sim3x, 2016-01-24
@pcdesign

User name cannot be "217"
unix.stackexchange.com/a/157431

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question