Ubuntu 20.04 - how to use systemctl to restart service after modifying environment file
I'm a bit lost with I've searched everywhere and can't find a clear answer. I tried several approaches but none seem to work. I've searched everywhere and can't find a clear answer. I'm having trouble with a service on Ubuntu 20.04 that won't restart properly after I've modified its environment file. I edited the environment file located at `/etc/default/my-service` to update an environment variable from 'old_value' to 'new_value'. After saving the changes, I tried to restart the service using `sudo systemctl restart my-service`, but I encountered the following behavior message: ``` Job for my-service.service failed because the control process exited with behavior code. See "systemctl status my-service.service" and "journalctl -xe" for details. ``` When I checked the status of the service with `systemctl status my-service.service`, I saw this: ``` â my-service.service - My Custom Service Loaded: loaded (/lib/systemd/system/my-service.service; enabled; vendor preset: enabled) Active: failed (Result: exit-code) since Tue 2023-10-03 10:00:00 UTC; 5s ago Docs: https://example.com/my-service-docs Process: 1234 ExecStart=/usr/bin/my-service-start (code=exited, status=1/FAILURE) Main PID: 1234 (code=exited, status=1/FAILURE) ``` I also looked at the journal logs using `journalctl -xe`, and I found this behavior: ``` my-service: Failed to read environment variable 'MY_ENV_VAR': No such file or directory ``` It seems like my service isn't picking up the changes from the environment file after I've modified it. I've also confirmed that the syntax in the environment file is correct. I've tried reloading the systemd manager configuration using `sudo systemctl daemon-reload` and then restarting the service again, but the scenario continues. Am I missing a step or is there something specific I should check in the environment file or service configuration? Any guidance would be greatly appreciated! My development environment is Linux. Am I missing something obvious? My development environment is macOS. My team is using Bash for this web app. Could someone point me to the right documentation? What's the correct way to implement this?