I have a udpater.service script meant to start a service application. The problem is that when I run the update job as a regular user, it works just fine. The minute that I try to do the same as a service... it fails to work. This is the updater.service in question:
# this is the updater service script.
[Unit]
Description=Meant to update the backup DB.
[Service]
SyslogIdentifier=Update_Backup_DB
Type=forking
User=update_user
WorkingDirectory=/common/deploy/scripts
ExecStart=/common/deploy/scripts/update_db.sh start
ExecStop=/common/deploy/scripts/update_db.sh stop
ExecReload=/common/deploy/scripts/update_db.sh restart
update_user is the user under which everything is supposed to run. The only thing that I can guess that's different are the environment variables. If I log into the server as update_user and print out "env", I see dozens of environment variables. If I print out "env" as the first executable line in update_db.sh, I see about 7 environment variables. It seems that not everything is being included in the runtime environment when update_db.sh is being run as a service. Is there a way to import the same environment variables when update_db.sh is run as a service?