google / cloud-print-connector

Google Cloud Print Connector
BSD 3-Clause "New" or "Revised" License
764 stars 184 forks source link

Unknown lvalue 'After network.target' in section 'Unit' #405

Open ganna60 opened 6 years ago

ganna60 commented 6 years ago

​I tried to start my-service on Centos 7 - instance on cloud. It does not work - shows the error: Unknown lvalue 'After network.target' in section 'Unit'

The same service, with exactly the same service and sh files and permissions works fine on my VirtualBox with the same Centos version.

Running my-portal service as a root user: `​​#systemctl start my-portal

[root@xxx# systemctl status my-portal -l ● my-portal.service - My Portal Service Loaded: loaded (/etc/systemd/system/my-portal.service; disabled; vendor preset: disabled) Active: inactive (dead)

Mar 29 09:15:30 centos-xxx systemd[1]: my-portal.service failed. Mar 29 09:18:00 centos-xxx systemd[1]: [/etc/systemd/system/my-portal.service:3] Unknown lvalue 'After network.target' in section 'Unit' Mar 29 09:18:03 centos-xxx systemd[1]: Starting My Portal Service... Mar 29 09:18:03 centos-xxx my-portal.sh[20106]: Starting my-portal ... Mar 29 09:18:03 centos-xxx my-portal.sh[20106]: my-portal started ... Mar 29 09:18:03 centos-xxx my-portal.sh[20109]: my-portal stoping ... Mar 29 09:18:03 centos-xxx my-portal.sh[20109]: /usr/local/bin/my-portal.sh: line 22: kill: (20107) - No such process Mar 29 09:18:03 centos-xxx my-portal.sh[20109]: my-portal stopped ... Mar 29 09:18:03 centos-xxx systemd[1]: Started my Portal Service. Mar 29 09:18:10 centos-xxx systemd[1]: [/etc/systemd/system/my-portal.service:3] Unknown lvalue 'After network.target' in section 'Unit' ` ​When I run application from terminal it works fine:

java -jar /opt/apps/egp/stage/my-portal/target/my-portal.jar server /opt/apps/egp/stage/my-portal/target/my-portal.yml >> /var/log/egp/my-portal.out

These are my files:


my-portal.service i /etc/systemd/system: `​[Unit] Description = My Portal Service After network.target = my-portal.service

[Service] Type = forking ExecStart = /usr/local/bin/my-portal.sh start ExecStop = /usr/local/bin/my-portal.sh stop ExecReload = /usr/local/bin/my-portal.sh reload

[Install] WantedBy=multi-user.target`

​my-portal.sh in /usr/local/bin (has all permissions):

!/bin/sh

SERVICE_NAME=my-portal PATH_TO_TARGET="/opt/apps/egp/stage/${SERVICE_NAME}/target" PATH_TO_LOG="/var/log/egp" PATH_TO_JAR="${PATH_TO_TARGET}/${SERVICE_NAME}.jar server ${PATH_TO_TARGET}/${SERVICE_NAME}.yml" PID_PATH_NAME=/var/run/${SERVICE_NAME}-pid case $1 in start) echo "Starting $SERVICE_NAME ..." if [ ! -f $PID_PATH_NAME ]; then nohup java -jar $PATH_TO_JAR >> ${PATH_TO_LOG}/${SERVICE_NAME}.out 2>&1& echo $! > $PID_PATH_NAME echo "$SERVICE_NAME started ..." else echo "$SERVICE_NAME is already running ..." fi ;; stop) if [ -f $PID_PATH_NAME ]; then PID=$(cat $PID_PATH_NAME); echo "$SERVICE_NAME stoping ..." kill $PID; echo "$SERVICE_NAME stopped ..." rm $PID_PATH_NAME else echo "$SERVICE_NAME is not running ..." fi ;; restart) if [ -f $PID_PATH_NAME ]; then PID=$(cat $PID_PATH_NAME); echo "$SERVICE_NAME stopping ..."; kill $PID; echo "$SERVICE_NAME stopped ..."; rm $PID_PATH_NAME echo "$SERVICE_NAME starting ..." nohup java -jar $PATH_TO_JAR >> ${PATH_TO_LOG}/${SERVICE_NAME}.out 2>&1& echo $! > $PID_PATH_NAME echo "$SERVICE_NAME started ..." else echo "$SERVICE_NAME is not running ..." fi ;; esac

​​# cat /etc/*-release

CentOS Linux release 7.4.1708 (Core).

Thank you.