Fedora Linux Support Community & Resources Center

Go Back   FedoraForum.org > Fedora 17/18 > Using Fedora
FedoraForum Search

Forgot Password? Join Us!

Using Fedora General support for current versions. Ask questions about Fedora and it's software that do not belong in any other forum.

Reply
 
Thread Tools Search this Thread Display Modes
  #1  
Old 6th June 2008, 09:47 PM
logiconcepts819 Offline
Registered User
 
Join Date: Feb 2008
Location: Schaumburg, IL
Posts: 13
SysV init script problem

Hi,

I'm trying to get an initialization script to work with the service program, and for some strange reason, I cannot get the desired program (in this case Timidity in daemon mode) to start successfully. However, when I execute the script directly, Timidity starts successfully. Here is /etc/init.d/timidity:

Code:
#!/bin/bash
#
# Startup script for the TiMidity++ ALSA sequencer interface
#
# chkconfig: 2345 20 65
# description:  TiMidity is a MIDI to WAVE converter and player that uses Gravis
#		Ultrasound(tm) or SoundFont(tm) patch files to generate digital
#		audio data from general MIDI files.
#
# processname: timidity
# config: /etc/sysconfig/timidity
### BEGIN INIT INFO
# Provides: timidity
# Should-Start: alsa
# Default-Start: 2 3 4 5
# Short-Description: MIDI to WAVE converter and player
# Description: TiMidity is a MIDI to WAVE converter and player that uses Gravis
#               Ultrasound(tm) or SoundFont(tm) patch files to generate digital
#               audio data from general MIDI files.
### END INIT INFO

# Source function library.
. /etc/rc.d/init.d/functions

# Get config.
. /etc/sysconfig/timidity

[ -x /usr/bin/timidity ] || exit 0

OPTIONS="-iADq -Os"
RETVAL=0

# See how we were called.
case "$1" in
  start)
	echo "Starting TiMidity++ ALSA sequencer interface:"
	if [ ! -f /var/lock/subsys/timidity ]; then
	
		# Parse options
		if [[ "$BUFNUM" =~ "[0-9]+" ]] && [[ "$BUFSIZE" =~ "[0-9]+" ]]; then
			OPTIONS="${OPTIONS} --buffer-fragments=${BUFNUM},${BUFSIZE}"
		fi
		[[ "$SAMPLERATE" =~ "[0-9]+" ]] && OPTIONS="$OPTIONS --sampling-freq=$SAMPLERATE"
		[ "$ANTIALIAS" = "true" ] && OPTIONS="$OPTIONS --anti-alias"
		[[ "$PRIORITY" =~ "[0-9]+" ]] && OPTIONS="$OPTIONS --realtime-priority=$PRIORITY"
		[ -n "$EXTRA_OPTIONS" ] && OPTIONS="$OPTIONS $EXTRA_OPTIONS"
		
		daemon timidity $OPTIONS
		RETVAL=$?
		[ $RETVAL -eq 0 ] && touch /var/lock/subsys/timidity
	else
		failure
	fi
	echo
	;;

  stop)
	echo "Shutting down TiMidity++ ALSA sequencer interface:"
	if [ -f /var/lock/subsys/timidity ]; then
		killproc timidity
		RETVAL=$?
		[ $RETVAL -eq 0 ] && rm -f /var/lock/subsys/timidity
	else
		failure
	fi
	echo
	;;

  status)
	status timidity
	RETVAL=$?
	;;

  reload)
	killproc -HUP timidity
	RETVAL=$?
	;;

  restart)
	$0 stop
	$0 start
	RETVAL=$?
	;;

  *)
	echo "Usage: %s {start|stop|status|reload|restart}\n" "$0"
	exit 1
esac

exit $RETVAL
and here is /etc/sysconfig/timidity, if you're curious:

Code:
# Number of buffers, and buffer size in 2^n
BUFNUM=2
BUFSIZE=10

# Sampling rate, default is 44100
SAMPLERATE=22050

# Antialias = "true" enhances sound quality
ANTIALIAS=false

# PRIORITY is the realtime priority. For more detail, see
# manpage sched_setscheduler(2), the part talking about SCHED_FIFO.
# this number is 0-100 inclusive.
#PRIORITY=10

# Any extra timidity options please go here
#EXTRA_OPTIONS=
This is the output I received when I attempted both methods of starting Timidity:

Code:
[root@gateway_nx570xl ~]# /sbin/service timidity start
Starting TiMidity++ ALSA sequencer interface:
*** PULSEAUDIO: Unable to connect: Connection refused
Can't open pcm device 'default'.
Couldn't open ALSA pcm device (`s')
                                                           [FAILED]
[root@gateway_nx570xl ~]# /etc/init.d/timidity start
Starting TiMidity++ ALSA sequencer interface:
TiMidity starting in ALSA server mode
Opening sequencer port: 128:0 128:1 128:2 128:3
                                                           [  OK  ]
This situation seems quite bizarre. Any suggestions on why this happens?
__________________
logiconcepts819


PC Type: Notebook
Brand: Gateway
Model No: NX570XL
CPU: Intel Core 2 Duo @ 1.66 GHz
RAM size: 2 GB
Fedora Version: 11
Reply With Quote
Reply

Tags
init, problem, script, sysv

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Init script time-outs problem jcat Using Fedora 2 19th January 2007 12:27 PM
2.6.5 kernel on fc1 init script problem (? i think) Less EOL (End Of Life) Versions 12 9th May 2004 10:29 PM


Current GMT-time: 05:29 (Wednesday, 22-05-2013)

TopSubscribe to XML RSS for all Threads in all ForumsFedoraForumDotOrg Archive
logo

All trademarks, and forum posts in this site are property of their respective owner(s).
FedoraForum.org is privately owned and is not directly sponsored by the Fedora Project or Red Hat, Inc.

Privacy Policy | Term of Use | Posting Guidelines | Archive | Contact Us | Founding Members

Powered by vBulletin® Copyright ©2000 - 2012, vBulletin Solutions, Inc.

FedoraForum is Powered by RedHat