0

I'm new with CentOS. I have a installed tilestream. Now want to tilestream start automaticaly after system restart. Do like this tutorial.

/etc/init/tilestream.conf

#!upstart
#description "node.js chatapp server"
#author      "subicura"

start on startup
stop on shutdown

script
   export HOME="/home/myuser"#

   echo $$ > /var/run/tilestream.pid
   exec /usr/bin/node /usr/bin/tilestream >> /var/log/tilestream.log 2>&1
end script

pre-start script
   # Date format same as (new Date()).toISOString() for consistency
   echo "[`date -u +%Y-%m-%dT%T.%3NZ`] (sys) Starting" >> /var/log/tilestream.log
end script

pre-stop script
   rm /var/run/tilestream.pid
   echo "[`date -u +%Y-%m-%dT%T.%3NZ`] (sys) Stopping" >> /var/log/tilestream.log
end script

In cterminal do:

/sbin/start tilestream

Output:

tilestream start/running, process 2428

In log:

[2014-06-27T08:32:55.316Z] (sys) Starting
Creating tiles dir /home/myuser#/Documents/MapBox/tiles
Started [Server Tile].
Started [Server Core:8888].

But TileStream not work.

If i start it with script /etc/init.d/tilestream

#!/bin/sh
### BEGIN INIT INFO
# Provides:          tilestream
# Required-Start:    $local_fs $remote_fs $network $syslog $named
# Required-Stop:     $local_fs $remote_fs $network $syslog $named
# Default-Start:     2 3 4 5
# Default-Stop:      0 1 6
# X-Interactive:     true
# Short-Description: Start TileStream server
### END INIT INFO

TILESTREAM="/usr/bin/tilestream"
MAPPATH="/data"
HOST="host"
#HOST="localhost"
#UIPORT="9001"
UIPORT="8888"
#TILEPORT="9000"
TILEPORT="8888"
SUBDOMAINS="a,b,c,d"

case $1 in
    start)
        echo "Starting TileStream"
       #$TILESTREAM --tiles=$MAPPATH --host=$HOST&
       #$TILESTREAM --tiles=$MAPPATH --host=$HOST --uiPort=$UIPORT --tilePort=$TILEPORT --subdomains=$SUBDOMAINS&
       $TILESTREAM --tiles=$MAPPATH --host=$HOST --uiPort=$UIPORT --tilePort=$TILEPORT&
        ;;
    stop)
        echo "Stopping TileStream"
        #PID=`ps aux | grep $TILESTREAM | grep -v grep | awk '{print $2}'`
    PID=`ps aux | grep "tilestream" | grep -v grep | awk '{print $2}'`
        kill -9 $PID
        ;;
    restart)
        echo "Restarting TileStream"
       $0 stop
       sleep 1
       $0 start
       ;;
    *)
        echo "Usage: $0 {start|stop|restart}" >&2
        exit 1
        ;;
    esac

In this case all work fine.
Any advices?

0

Append the options that you pass in the init script to the tile stream command, but before the stdout/in redirection.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.