Skip to content

[question] How to write proper upstart script for watchman #8

Closed

Description

@jeffreycahyono

I am using ubuntu 12.10, and tried to create upstart script for watchman but the status is always stop although it is running.
Here is my current upstart watchman.conf

description "Watchman service"

start on started beanstalkd
stop on runlevel [!2345]

respawn
respawn limit 5 2

script
    exec  sudo -u root /var/bi/bin/watchman watch /var/bi/var/dbf & /var/bi/bin/watchman -- trigger /var/bi/var/dbf importPr "*.DBF" "*.dbf" -- /var/bi/bicmd importPr
end script

Activity

  1. wez commented on Jun 11, 2013

    @wez
    Contributor

    You shouldn't need to do this. Watchman will detach and put itself in the background when it starts up.
    If you need to run it under a supervisor, you should probably use the --foreground option.

    Note that the watchman model is one service per user. Launching a root-owned watchman on startup will only benefit the root user.

    We use https://bitbucket.org/wez/gimli to maintain and supervise our watchman processes per user. You can enable this at compile time if you run ./configure --with-gimli

  2. wez commented on Jun 11, 2013

    @wez
    Contributor

    just scrolled right to read what you're running.
    Watches are persistent, so you should probably do:

    /var/bi/bin/watchman watch /var/bi/var/dbf
    /var/bi/bin/watchman -- trigger /var/bi/var/dbf importPr "*.DBF" "*.dbf" -- /var/bi/bicmd importPr
    

    once to set it up, then have your upstart script be something like:

    script
      exec sudo -u root /var/bi/bin/watchman --foreground
    end script
    
  3. jeffreycahyono commented on Jun 12, 2013

    @jeffreycahyono
    Author

    @wez Thanks for your helpful response. --foreground works! In my system watches are reseted on system startup. But ----statefile can fix that. Now my upstart config is like this and it worked.

    description "Watchman service"
    
    start on started beanstalkd
    stop on stopping beanstalkd
    
    script
        exec sudo -u root /var/bi/bin/watchman --statefile=/var/bi/.watchman.root.state --logfile=/var/bi/var/log/watchman.log --foreground
    end script
  4. added a commit that references this issue on Oct 28, 2013
  5. added a commit that references this issue on Aug 20, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions