[amphetadesk-develop] Setup amphetadesk as auto start service
Status: Beta
Brought to you by:
morbus
From: Digant C K. <di...@di...> - 2002-10-23 21:15:55
|
Hello, I'm fairly new to Linux but I think I got this stuff right. Here are the steps that have to be taken to add Ampheta Desk as an autostarting service. 1) Save the attached file as /etc/init.d/amphetadesk. 2) chmod 755 amphetadesk 3) Using your favorite text editor, edit the file and update the variables under the CONFIGURE section. The only variable you absolutely have to change is the ADEXEC variable (you can find the value for this variable by running locate AmphetaDesk.pl). 4) chkconfig --add amphetadesk 5) service amphetadesk start The amphetadesk file is below. Copy and paste the section between the BEGIN and END tags into a file called amphetadesk. ---------------[ BEGIN ]--------------- #!/bin/bash # # AmphetaDesk Start/Stop the AmphetaDesk application. # # chkconfig: 2345 55 25 # description: AmphetaDesk is an open source new aggregator \ # available at http://www.disobey.com/amphetadesk # processname: amphetadesk # CONFIGURE THE FOlLOWING OPTIONS # ADEXEC = the path and executable name for Ampheta Desk ADEXEC=/var/ampheta/AmphetaDesk.pl # LOGFILE = file or device to send stdout text to LOGFILE=/dev/null # LOCKPATH = path to the lock file (no trailing slash) LOCKPATH=/var/lock/subsys # Source function library. . /etc/init.d/functions RETVAL=0 stop() { echo -n "Stopping AmphetaDesk: " killproc $ADEXEC RETVAL=$? echo [ $RETVAL -eq 0 ] && rm -f $LOCKPATH/amphetadesk return $RETVAL } start() { echo -n "Starting AmphetaDesk: " if [ ! -e $LOCKPATH/amphetadesk ] then $ADEXEC > $LOGFILE & RETVAL=$? else echo -n "App already running...." RETVAL=1 fi echo [ $RETVAL -eq 0 ] && touch $LOCKPATH/amphetadesk return $RETVAL } restart() { stop start RETVAL=$? return $RETVAL } # Process command/parameter case "$1" in start) start ;; stop) stop ;; status) status $ADEXEC RETVAL=$? ;; restart) restart ;; *) echo $"Usage: $0 {start|stop|restart|status}" RETVAL=1 esac exit $RETVAL ---------------[ END ]--------------- |