Install as a daemon - rembo10/headphones GitHub Wiki
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) to0.0.0.0
and then restart the service withservice 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
- SetName
to "Headphones". SetSecurity Options
to "Run whether user is logged in or not." ClickChange 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 yourheadphones.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.
Debian (systemd, non-root user)
This configuration will set up a systemd service on your normal user, without root nor system users. The install dir can be anywhere on your home dir, but this guide assumes ~/headphones
.
- Install headphones:
git clone https://github.com/rembo10/headphones.git
- Create a systemd user service:
nano ~/.config/systemd/user/headphones.service
(create folder if it doesn't exist) - An example service is provided below. Make sure to replace
YOUR_USERNAME
and choose a different data dir if you wish.[Unit] Description=Headphones Service After=network.target [Service] Type=simple ExecStart=python3 Headphones.py --datadir userdata/ WorkingDirectory=/home/YOUR_USERNAME/headphones Restart=on-failure [Install] WantedBy=default.target
- Allow your user to linger:
loginctl enable-linger $USER
- Reload the systemd daemon:
systemctl --user daemon-reload
- Start the service
systemctl --user start headphones.service
- Optionally, enable the service (start at boot):
systemctl --user enable --now headphones.service
Note that you need to reload the daemon every time you modify the service file. Don't use ~/
as your home, since that's a shell glob and not a valid path.
Check the server status with journalctl: journalctl --user -u headphones.service
.