Hello guys, I’m currently trying to use this value for user_data:
#cloud-config
runcmd:
- curl https://mysupercooldomain.tld/do.sh | sh
The content of do.sh is:
#!/bin/bash
echo "doing" > status
dpkg --add-architecture i386
apt-get -y update
apt-get -y install mailutils postfix curl wget file bzip2 gzip unzip bsdmainutils python util-linux ca-certificates tmux lib32gcc1 libstdc++6 libstdc++6:i386
adduser --disabled-password --gecos "Game Server" gameserver
su - gameserver
wget https://mysupercooldomain.tld/gameserver
chmod +x gameserver
./gameserver install
After creating a Droplet, the Droplet does not contain the data it should contain.
Something wrong?
This textbox defaults to using Markdown to format your answer.
You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!
Accepted Answer
Hi @NicolaDL
Try encapsulating it in single quotes '
, since it will then write the string to a temporary file and execute that file with sh
. And since it’s a bash script, you can parse it directly to bash instead of sh.
#cloud-config
runcmd:
- 'curl https://mysupercooldomain.tld/do.sh | /bin/bash -s'
Get paid to write technical tutorials and select a tech-focused charity to receive a matching donation.
Full documentation for every DigitalOcean product.
The Wave has everything you need to know about building a business, from raising funding to marketing your product.
Stay up to date by signing up for DigitalOcean’s Infrastructure as a Newsletter.
New accounts only. By submitting your email you agree to our Privacy Policy
Scale up as you grow — whether you're running one virtual machine or ten thousand.
Sign up and get $200 in credit for your first 60 days with DigitalOcean.*
*This promotional offer applies to new accounts only.