pyTivo Discussion Forum Forum Index pyTivo Discussion Forum
Answers and the development of pyTivo a TiVo transcoding server
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Ubuntu 8.10 startup script

 
Post new topic   Reply to topic    pyTivo Discussion Forum Forum Index -> Hacks
 View previous topic :: View next topic  
Author Message
choekstr



Joined: 06 Dec 2008
Posts: 152

PostPosted: Sun Dec 14, 2008 8:21 pm    Post subject: Ubuntu 8.10 startup script Reply with quote

All,
I was tired of seeing a non-standard Ubuntu start message when pytivo starts during boot so I modified windracer's script to add ubuntu specific functions so now the right justified [DONE] or [FAIL] show properly. This requires the standard /lib/lsb/init-functions to be sources prior to running but it now mimics a standard Ubuntu startup script and behaves accordingly.

I called this pytivo and put it in /etc/init.d and then created symlinks to the appropriate /etc/rc?.d folders. You could also use sysv-rc-conf to create the links as an easier method. Don't forget to do a chmod 755 pytivo once you create the file.

Use if you feel like it:

Code:
#!/bin/bash
# description: pyTivo server

### INIT INFO
# Provides: pytivo
# Short-description: pyTivo server
# Description: Start and stop the pyTivo server.
### END INIT INFO

RETVAL=0

. /lib/lsb/init-functions

start() {
        log_daemon_msg "Starting pyTivo server" "pytivo"
        pgrep -f pyTivo.py > /dev/null
        RETVAL=$?
        [ $RETVAL -eq 0 ] && echo "pyTivo already running: Exiting" &&
exit 1

        # this call actually starts pyTivo.
        /usr/bin/python /opt/pytivo/pyTivo.py > /dev/null 2>&1 &
        pgrep -f pyTivo.py > /dev/null
        RETVAL=$?
        log_end_msg $RETVAL
        return $RETVAL
}

stop() {
        log_daemon_msg "Stopping pyTivo server" "pytivo"
        pkill -f pyTivo.py > /dev/null
        RETVAL=$?
        log_end_msg $RETVAL
        return $RETVAL
}

# See how we were called.
case "$1" in
start)
        start
        ;;
stop)
        stop
        ;;
restart|reload)
        stop
        sleep 3
        start
        RETVAL=$?
        ;;
*)
        echo "Usage: $0 {start|stop|restart}"
        exit 1
        esac
        exit $RETVAL


Last edited by choekstr on Wed Apr 29, 2009 2:00 pm; edited 1 time in total
Back to top
View user's profile Send private message
windracer



Joined: 04 Jan 2008
Posts: 219
Location: St. Pete, FL

PostPosted: Tue Dec 16, 2008 2:49 pm    Post subject: Reply with quote

Just wanted to point out I didn't originally write the init script (but did make small modifications to it). Wink

Nice mod though ... I'll give it a shot.

_________________
pyTiVo on Ubuntu 11.10 (Oneiric)
Back to top
View user's profile Send private message AIM Address Yahoo Messenger
Display posts from previous:   
Post new topic   Reply to topic    pyTivo Discussion Forum Forum Index -> Hacks All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You cannot download files in this forum
Site is in NO WAY affiliated with TiVo Inc

Powered by phpBB © 2001, 2005 phpBB Group
phpBB SEO

Get pytivo at SourceForge.net. Fast, secure and Free Open Source software downloads
[ Time: 0.1306s ][ Queries: 12 (0.0110s) ][ GZIP on - Debug on ]