[How-To] Have Mylar automatically start with computer

Information and Tutorials on features in Mylar and how to use it
User avatar
Site Admin
Posts: 2369
Joined: Sat Apr 20, 2013 3:43 pm

[How-To] Have Mylar automatically start with computer

Post by evilhero » Wed Oct 23, 2013 5:37 pm

Installing as a daemon is relatively an easy step, and follows along the lines of other similar programs.


To setup Mylar as a service:
  • There are now 2 files that are required in order to use Mylar as this type of service (ubuntu.init.d & ubuntu.default.mylar). If you have mylar running in the /opt there are verbatim instructions at the beginning of the ubuntu.init.d script.

    - sudo chmod +x /wherever/mylar/is/init-scripts/ubuntu.init.d

    - copy the ubuntu.init.d file to /etc/init.d/ and rename it to 'mylar' (or symlink it : sudo ln -s /wherever/mylar/is/init-scripts/ubuntu.init.d /etc/init.d/mylar)
    (Do not edit this file - all of the configuration values are now stored in the ubuntu.default.mylar file)

    - edit the ubuntu.default.mylar file and add/change the appropriate values as required by either uncommenting out the '##' at the beginning of the lines OR just creating new lines after all the Remarks (the ## stuff) at the end of the file. Save the file as 'mylar' and move/copy it to /etc/default/mylar.

    Code: Select all

    ## MYLAR_USER= username to run mylar under, the default is mylar
    ## MYLAR_HOME= the location of mylar.py, the default is /opt/mylar
    ## MYLAR_DATA= the location of mylar.db, cache, logs, the default is /opt/mylar
    ## MYLAR_PIDFILE= the location of mylar.pid, the default is /var/run/mylar/mylar.pid
    ## PYTHON_BIN= the location of the python binary, the default is /usr/bin/python
    ## MYLAR_OPTS= extra cli option for mylar, i.e. " --config=/home/mylar/config.ini"
    ## SSD_OPTS= extra start-stop-daemon option like " --group=users"
    ## MYLAR_PORT= hardcoded port for the webserver, overrides value in config.ini

To have Mylar automatically start when the computer starts:
  • - sudo update-rc.d mylar defaults

Code: Select all

    sudo service mylar { start | stop | reload | restart }

Start Mylar on startup (with a python console window):
  • - Create a shortcut to Mylar.py in your startup folder
Start Mylar on startup (with no python window):
  • - Rename Mylar.py to Mylar.pyw
    - Create a shortcut to Mylar.pyw in your startup folder
Ensure that you turn off the setting Launch Browser on Startup so that you don't have a browser open up every time.