sudo ./starling start works well but sudo service starling start fails
- by Keating Wang
sudo ./starling start works well but sudo service starling start fails
$ sudo ./starling start
* Starting Starling Server... [ OK ]
$ sudo ./starling stop
* Stop Starling Server... [ OK ]
$ sudo service starling stop
* Starting Starling Server...
/home/keating/.rvm/rubies/ruby-1.9.2-p290/lib/ruby/site_ruby/1.9.1/rubygems/dependency.rb:247:in
`to_specs': Could not find starling (>= 0) amongst [minitest-1.6.0,
rake-0.8.7, rdoc-2.5.8] (Gem::LoadError) from
/home/keating/.rvm/rubies/ruby-1.9.2-p290/lib/ruby/site_ruby/1.9.1/rubygems/dependency.rb:256:in
`to_spec' from
/home/keating/.rvm/rubies/ruby-1.9.2-p290/lib/ruby/site_ruby/1.9.1/rubygems.rb:1229:in
`gem' from /home/keating/.rvm/gems/ruby-1.9.2-p290/bin/starling:18:in
`<main>'
The error above is 'cannot find gem starling'
Following the starling file(located in /etc/init.d, rwxrwxrwx):
set -e
LOGFILE=/var/log/starling/starling.log SPOOLDIR=/var/spool/starling
PORT=22122 LISTEN=127.0.0.1 PIDFILE=/var/run/starling.pid
NAME=starling DESC="Starling"
INSTALL_DIR=/home/keating/.rvm/gems/ruby-1.9.2-p290/bin/
DAEMON=$INSTALL_DIR/$NAME SCRIPTNAME=/etc/init.d/$NAME
OPTS="-d"
. /lib/lsb/init-functions
d_start() {
log_begin_msg "Starting Starling Server..."
start-stop-daemon --start --quiet --pidfile $PIDFILE --exec $DAEMON -- $OPTS || log_end_msg 1
log_end_msg 0 }
d_stop() {
log_begin_msg "Stopping Starling Server..."
start-stop-daemon --stop --quiet --pidfile $PIDFILE || log_end_msg 1
log_end_msg 0 }
case "$1" in start) d_start ;; stop) d_stop ;;
restart|force-reload|reload) d_stop sleep 2 d_start ;;
*) echo "Usage: $SCRIPTNAME {start|stop|restart|force-reload}" exit 3 ;; esac
exit 0