Why is my stack script not executing on server creation?
When I log in to my box there is a file called StackScript in the root directory, and if I run ./StackScript it executes, but I thought the whole point of these scripts were to run automatically? If my script is simple as
!/bin/bash
mkdir test
there is no test directory when I connect through ssh.. but if I run ./StackScript, there's a test directory. So I know the script is working.. it just isn't being executed. Am I missing something?
1 Reply
Stackscripts are run automatically at the moment of server creation, and they're intended to make it easy to deploy custom systems. If you created a Stackscript, technically the only time it should be run is when you create a Linode:
- https://www.linode.com/docs/guides/creating-and-managing-stackscripts-a-tutorial/
- https://www.linode.com/docs/guides/common-stackscripts-use-cases/
To test out your use-case, I created a Stackscript on my own account which read as follows:
#!/bin/bash
mkdir test
I then deployed a server using this Stackscript and I was able to locate the test
directory on my server (test
was nested in the root /
directory):
root@localhost:~# cd / && ls -la | grep -i test
drwxr-xr-x 2 root root 4096 Jun 2 16:42 test