Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7080203
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T06:45:58+00:00 2026-05-28T06:45:58+00:00

I’m using upstart v1.4 to start my application server, it’s called unicorn . The

  • 0

I’m using upstart v1.4 to start my application server, it’s called unicorn.

The upstart configuration file looks like this:

description "Unicorn Application Server"

start on network
stop on runlevel [!2345]

umask 0003
setuid unicorn
setgid myproject
chdir /opt/myproject/

respawn

exec /opt/myproject/bin/unicorn --config-file /opt/myproject/config/unicorn.rb --env production

It’s essential that the process run with 0774, that is ug+rwxo+r, at least for directories. User & Group are shared as such as the nginx server, uploads, staff logging in, etc.

I have observed that the directories are created with the wrong permissions:

drw-rw-r-- 2 unicorn       myproject        4096 2012-01-13 06:58 20120113-0658-7704-4676

So far as I am aware, nothing in my application is causing this.

According to attaching gdb to the process, and calling call umask(0), the effective umask is 75, or 0o113.

Here’s the gdb session:

root@1:/opt/myproject# cat ./tmp/pids/unicorn.pid 
7600

root@1:/opt/myproject# gdb
GNU gdb (GDB) 7.1-ubuntu

(gdb) attach 7600
Attaching to process 7600

(gdb) call umask(0)
$1 = 75

(gdb) call umask(75)
$2 = 0

(gdb) q
Quit anyway? (y or n) y
Detaching from program: /usr/local/bin/ruby, process 7600

root@1:/opt/myproject# ruby -e 'printf("%o\n", 75)'
113

The umask of 113 would account for permissions being made to 664, which appears to be what I’m seeing.

What am I doing wrong here, is Unicorn misbehaving? Is upstart ignoring my stanza? Should I be defining the stanza as 003, not 0003? Is my gdb session work, and %o printf() syntax correct?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-28T06:45:59+00:00Added an answer on May 28, 2026 at 6:45 am

    How does “unicorn” behave outside of an Upstart environment? I would guess exactly the same but please check this (keep everything as simple as possible).

    Remember that a umask value is not an absolute: as the name suggests, it is a mask – it “subtracts” permission bits from the permission bits your application specifies when it opens a file or creates a directory. Upstarts umask stanza is behaving from what I can see so your problem must be with this unicorn application specifying what is to you an odd set of permission bits (mode) when it opens files for writing and creates directories.

    Try stracing unicorn to see what it is actually doing:

      strace -o /tmp/strace.log -fFv -s 1024 /opt/myproject/bin/unicorn --config-file ...
    

    Having waited for unicorn to create some files and/or directories, stop/kill it and look at file /tmp/strace.log. grep for “open(FILE)” where FILE is the name of one of the files it creates for example and see what the 3rd argument is to the open system call. When you have that mode value it should be possible to construct a umask value to give the file permissions you desire. Note that this does assume that unicorn:

    • is consistent with the mode it specifies.
    • does not call umask(2) itself (which would override the Upstart umask stanza).
    • does not call chmod(2)/fchmod(2).

    If — after having following the process above — you still think there is an issue with Upstart, please provide a simple test case (that does not require unicorn) and raise a bug here: https://bugs.launchpad.net/upstart/+filebug.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a string like this: La Torre Eiffel paragonata all’Everest What PHP function
For some reason, after submitting a string like this Jack’s Spindle from a text
I'm parsing an RSS feed that has an ’ in it. SimpleXML turns this
We are using XSLT to translate a RIXML file to XML. Our RIXML contains
I am trying to render a haml file in a javascript response like so:
I'm new to using the Perl treebuilder module for HTML parsing and can't figure
That's pretty much it. I'm using Nokogiri to scrape a web page what has
link Im having trouble converting the html entites into html characters, (&# 8217;) i
I have just tried to save a simple *.rtf file with some websites and
I would like to count the length of a string with PHP. The string

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.