--- title: "Run a script when a node starts" description: "Add a start script when you create a node so it runs automatically every time the node starts or reboots." content_type: "how-to" product: "node" platform: "MyAccount" url: "/myaccount/node/how-to/run-a-script-at-first-boot/" topic: ["create-and-connect"] --- # Run a script when a node starts A start script runs on your node every time it starts, including every reboot. Use it to skip the manual work of connecting after every boot to install a package, mount something, or start a service yourself. ## Add the script While [creating the node](/myaccount/node/how-to/create-a-node), open **Advanced settings** and check **Add Start Script**. Paste your script into the field that appears (up to 2,048 characters), then continue through the summary and click **Launch**. Once the node finishes creating and starts running, your script runs on its own, before you connect to it. The script runs again on every reboot. For anything you want to happen only once, add a check inside the script itself. For example, test for a marker file at the start, and skip the rest if it is already there. On Ubuntu, that looks like this: ```bash #!/bin/bash [ -f /var/lib/first-boot-done ] && exit 0 apt-get update && apt-get install -y nginx touch /var/lib/first-boot-done ``` To check that the script ran, connect to the node and look for what it should have done: the package installed, the service running, or the marker file in place. See [Connect to a Linux node](/myaccount/node/how-to/connect-to-a-linux-node/).