0

I am working to create a service that triggers a script upon boot. The script then installs and activates a piece software. I only want this service to run once so that it installs the software on initial boot. This is being built into an AMI for standard deployment in an enterprise.

I currently have the following:

/etc/systemd/system/startup.service (executable using chmod +x; enabled using "systemctl enable startup.service")

/var/tmp/LinuxDeploymentScript.sh

The service contains:

[Unit]
After=remote-fs.target

[Service]
Type=oneshot
User=root
ExecStart=/var/tmp/LinuxDeploymentScript.sh

[Install]
WantedBy=multi-user.target

When I test the service by using systemctl start startup.service it runs successfully, but when I leave it enabled and reboot the system, it fails to activate:

Screenshot of failure log

Any help would be great. I have a thought that it could be my After= setting may not be far enough into the computer spinning up to be successful.

RedKnite
  • 1,525
  • 13
  • 26
  • maybe your script tries to download from external sources, but network is not yet loaded correctly. you could modify your deploy script with checking the external source and leave a note in journal if not able to connect. – tswaehn Jun 06 '20 at 23:26
  • you may want to check here if your deploy script needs networking: https://stackoverflow.com/questions/35805354/systemd-start-service-at-boot-time-after-network-is-really-up-for-wol-purpose – tswaehn Jun 06 '20 at 23:37
  • 2
    I think you are both right. I changed the `After=` to `network.target` and that seemed to do the trick! – Justin Lawhorne Jun 08 '20 at 01:36

0 Answers0