(2012-07-09, 23:33)rflores2323 Wrote: I have headphones installed on ubuntu 10.04 and want it to startup on boot. I have checked in the init.d folder and I do not not have a headphones startup script. I do however have a init.ubuntu script in my headphones folder. Can I use this file to make the scipt ,rename it to headphones, and place it in my init.d folder? Also should I run this as root or my user xbmc since headphones is installed in my home folder?
The below is what shows up for this file.
This is the way I did it. I used
Ainer's awesome script for sickbeard (all credit goes to him, I merely hamfisted my way through it), modified the paths within to start Headphones, and boom, all done. I have used this same script for headphones, Sickbeard, and CouchPotato, and it works great. I didn't change all the references to Sickbeard in this script, obviously, as I was lazy and they weren't critical to change. After it's all done, save it, and drop it in the init.d folder...like a boss.
I have encased the areas you need to change in **the asteriks** (be sure to remove the **'s from the code). Double check it, but I think I highlighted all the areas I changed. After it's done save it as whatever (I just named them headphones, sickbeard, etc.), drop it in the init.d folder and reboot to make sure it works.
EDIT: I forgot to mention I am running xbmcbuntu, if it matters.
DOUBLE EDIT: Make sure when you're done, you go to your init.d file, right click on your newly created script, and make sure "make the file executable" is checked.
Code:
#! /bin/sh
# Author: daemox
# Basis: Parts of the script based on and inspired by work from
# tret (sabnzbd.org), beckstown (xbmc.org),
# and midgetspy (sickbeard.com).
# Fixes: Alek (ainer.org), James (ainer.org), Tophicles (ainer.org),
# croontje (sickbeard.com)
# Contact: http://www.ainer.org
# Version: 3.1
### BEGIN INIT INFO
# Provides: headphones
# Required-Start: $local_fs $network $remote_fs
# Required-Stop: $local_fs $network $remote_fs
# Should-Start: $NetworkManager
# Should-Stop: $NetworkManager
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: starts and stops headphones
# Description: Automatic music downloader for SABnzbd. For more information see:
# http://http://headphones.codeshy.com/forum/
### END INIT INFO
#Required -- Must Be Changed!
USER="**YOUR USERNAME**" #Set Linux Mint, Ubuntu, or Debian user name here.
#Required -- Defaults Provided (only change if you know you need to).
HOST="**127.0.0.1**" #Set headphones address here.
PORT="**8084**" #Set headphones port here.
#Optional -- Unneeded unless you have added a user name and password to Headphones.
SBUSR="" #Set Headphones user name (if you use one) here.
SBPWD="" #Set Headphones password (if you use one) here.
#Script -- No changes needed below.
case "$1" in
start)
#Start Sick Beard and send all messages to /dev/null.
cd **/home/$USER/.headphones**
echo "Starting Headphones...like a boss"
sudo -u $USER -EH nohup python **/home/$USER/.headphones/Headphones.py** -q > /dev/null 2>&1 &
;;
stop)
#Shutdown Sick Beard and delete the index.html files that wget generates.
echo "Stopping Headphones...LIKE A BOSS"
wget -q --user=$SBUSR --password=$SBPWD "http://$HOST:$PORT/home/shutdown/" --delete-after
sleep 6s
;;
*)
echo "Usage: $0 {start|stop}"
exit 1
esac
exit 0