Attempting to run a bash script via user-data on creation isn't working and no logs

Posted March 3, 2015 9.5k views
CentOSControl PanelsLogging

On Google/EC2 I run a bash script to setup a server and after reading it seems like I can do that on DigitalOcean too.

I’m running into an issue though where the script isn’t running however and I can’t find where the logs are. On Google/EC2 they’re in /var/log/messages on CentOS but I couldn’t find anything in there on DO and the install.log files in /root/ don’t have anything about the script either.

The user-data I’m trying to run is:


curl {script url} | sh

If I log into the box and run that curl/pipe it works fine. I’m using the Control Panel to create the droplet. Is there something I’m missing? Thanks!

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

Submit an Answer
7 answers

Thanks for brining this to Q&A. Much easier than going over it 140 chars at a time =)

I would recommend using the following in your user-data when creating the droplet in order to accomplish this:


  - curl {script url} | sh

Since it is a single line, a full bash script shouldn’t be necessary.

That didn’t run it either :( I also looked in /var/log/messages and still didn’t see anything there referencing that it ever ran this script. I also looked through other logs in /var/log/ and didn’t see anything about it either. Is there another spot where the output goes when this is run?

Did you ever solve this problem? I have the same problem with my newly created droplets (ams3, Debian 7 x64). The user data is available from the meta-data service: “curl” but it’s not getting executed.

Script (bash) works fine when run manually on the droplet.

Unfortunately, it looks as though “User Data” scripts do not run automatically on CentOS 6.x (versions < 7).

Sorry to bring an old post up, but I’m having the same issue with a new Centos 7 droplet. This user script - - won’t get excecuted on droplet creation.

have to say via api I made the mistake of using the field user-data rather than the correct one which is user_data . Once I realised this it worked!!! might help somebody....

Even I am unable to run the script. I am using API V2

“name”: “”,
“region”: “nyc3”,
“size”: “s-1vcpu-1gb”,
“image”: “ubuntu-16-04-x64”,
“sshkeys”: null,
“backups”: false,
“ipv6”: false,
data”: “#cloud-config runcmd: - curl <URL> | sh”,
“private_networking”: null,
“volumes”: null,
“tags”: [

Please help me regarding what am I doing wrong here?