Skip to content

Install as a daemon

Cory edited this page May 18, 2017 · 38 revisions

These steps are presented as guidelines. Your results may vary, depending on operating system, installation path and other settings.

Ubuntu

This installation assumes Headphones is installed to /opt/headphones. Make sure all paths are correct and accessible. A common mistake is that a daemon user has no read and/or write permissions.

  • cd /opt/headphones
  • sudo touch /etc/default/headphones
  • Optional:
    • sudo adduser --system --no-create-home headphones
    • sudo chown headphones:nogroup -R /opt/headphones
  • Adjust settings in /etc/default/headphones. See the comments in /opt/headphones/init-scripts/init.ubuntu for the list of parameters.
  • sudo chmod +x /opt/headphones/init-scripts/init.ubuntu
  • sudo ln -s /opt/headphones/init-scripts/init.ubuntu /etc/init.d/headphones
  • sudo update-rc.d headphones defaults
  • sudo update-rc.d headphones enable
  • sudo service headphones [start | stop | reload | restart | status]
  • To allow Headphones WebGUI access from another machine, you will need to stop the service with service headphones stop, modify /opt/headphones/config.ini, change the 'localhost' entry (both customhost and http_host) to 0.0.0.0 and then restart the service with service headphones start. i.e. You're running a headless Debian installation and need to allow other client's to login to this service.

CentOS / RedHat

This installation assumes Headphones is installed to /home/sabnzbd/headphones. Make sure all paths are correct and accessible. A common mistake is that a daemon user has no read and/or write permissions.

  • sudo adduser --system sabnzbd
  • mkdir /home/sabnzbd
  • mkdir /etc/headphones
  • cd /home/sabnzbd
  • git clone https://github.com/rembo10/headphones.git
  • sudo cp /home/sabnzbd/headphones/init-scripts/init.fedora.centos.systemd /home/sabnzbd/headphones/init-scripts/headphones.service
  • sudo chmod +x /home/sabnzbd/headphones/init-scripts/headphones.service
  • sudo touch /etc/headphones/headphones.ini
  • sudo chown -R sabnzbd:sabnzbd /home/sabnzbd
  • sudo chown sabnzbd:sabnzbd /etc/headphones/headphones.ini
  • sudo cp /home/sabnzbd/headphones/init-scripts/headphones.service /lib/systemd/system/headphones.service
  • sudo systemctl daemon-reload
  • sudo systemctl enable headphones.service
  • sudo service headphones [start | stop | reload | restart]
  • Browse to http://localhost:8181 to customize

Synology

  • Go to your DSM > Users > Create user and create user headphones
  • chown -R headphones:users /volume1/@appstore/headphones
  • wget -O /opt/etc/init.d/S99headphones.sh http://dl.dropbox.com/u/5653370/syn_files/headphones/S99headphones.sh
  • chmod a+x /opt/etc/init.d/S99headphones.sh
  • /opt/etc/init.d/S99headphones.sh [start | stop | restart | update]

Mac OS X

Tested on Mac OS X 10.8.2. Assumes Headphones is installed to /Applications/Headphones/

  • cp /Applications/Headphones/init-scripts/init.osx ~/Library/LaunchAgents/com.rembo10.headphones.plist (do not symlink!)
  • launchctl [load | unload] ~/Library/LaunchAgents/com.rembo10.headphones.plist

Windows

Tested on Windows 7 (similar process should work on 8+). This method will startup the headphones application even before a Windows user logs in. With Windows 7+ there is no need to mess with srvany, nssm, etc. This assumes you have a working headphones.py.

  • Open up the Window's Task Scheduler application (Taskschd.msc).
  • Right-click on "Task Scheduler Library" and choose "Create Task" (NOT "Create Basic Task").
  • Set the following on each respective tab:
  • General - Set Name to "Headphones". Set Security Options to "Run whether user is logged in or not." Click Change user or group and type "System" in the object name to select. Click "OK"
  • Triggers - Click "New". Under "Begin the Task" select "At startup." Click "OK"
  • Actions - Click "New". Set the script location to your headphones.py file (in double quotes). Click "OK"
  • Conditions - Uncheck all boxes.
  • Settings - Uncheck all boxes except "Allow task to be run on demand."
  • Click "OK" on the new task and supply your administrator credentials.
  • Script can be tested by right-click and Run. You should see a new instance of python appear in your task manager.