i am trying to setup a script to be run as systemd service running as a different user than root. My .service looks like this:
schedulescript.service
[Unit]
Description=Scheduler Script service
Requires = rsyslog.service network.target
After = rsyslog.service network.target
[Service]
Type=simple
User=svc.schd
ExecStart=/bin/sh /u01/apps/schedulescript.sh
[Install]
WantedBy=multi-user.target
When run as "systemctl start schedulescript.service" it works fine however upon reboot it fails with below status
**Aug 17 13:11:07 dfw-vd-gwalt3.dev.svbank.com systemd[1]: Started Schedulescript Script service.
Aug 17 13:11:07 dfw-vd-gwalt3.dev.svbank.com systemd[1]: schedulescript.service: main process exited, code=exited, status=217/USER
Aug 17 13:11:07 dfw-vd-gwalt3.dev.svbank.com systemd[1]: Unit schedulescript.service entered failed state.
Aug 17 13:11:07 dfw-vd-gwalt3.dev.svbank.com systemd[1]: schedulescript.service failed.
I believe this is happening because upon reboot when it tries to execute it cannot find svc.schd user as it has not come up properly.
When i get a proper response for "systemd-analyze" and then try to run the service it works fine.
If anyone can tell what is the service which has to be set in "After" block so that my service can wait on that specific user to be available after reboot?