0

I am running a bourne shell script from a service script.

When I check $env from my #!/bin/sh script started by script the user is ROOT and path is [/]

Is there a way to pass the env of the logged in user to the shell script from the service?

Is there some decent way to handle it so that I can get the currently logged in user and not an empty env with root user?

Hauke Laging
  • 88,146
  • 18
  • 125
  • 174
user1610950
  • 759
  • 2
  • 9
  • 22
  • 4
    Possible duplicate of [How to make unix service see environment variables?](https://unix.stackexchange.com/questions/44370/how-to-make-unix-service-see-environment-variables) – George Udosen Jan 12 '18 at 16:27
  • See this also: https://askubuntu.com/questions/676007/how-do-i-make-my-systemd-service-run-via-specific-user-and-start-on-boot – George Udosen Jan 12 '18 at 16:28
  • These aren't startup scripts; the system will need to be up, running and a user needs to be logged in before these scripts will ever be called. – user1610950 Jan 14 '18 at 01:26

0 Answers0