# Author: Martti Vasar
# Date: 08/03/2012
#
# These commands are triggered before the other commands and for each servers, commands defined
# here are started. If you want to add commands, that are run for every instance, just write them
# here, if you want to remove, you can delete the line or use # comment mark, the program will
# ignore comment lines
#
# There are two command types, one is running the command in the instance (R), the other is 
# copying files from local (from this) machine to remote machine (C). For running commands, use
# R as an indicator and for copying, use C as an indicatior. If using C, make sure you do 
# not use spaces in file names, first is where the file is located in the local file system
# and the second is where to copy the file in the remote system.

# Description: 
# Stops all the services running on the instance, so we can start from the clean system in terms 
# of nothing running there yet.

# close MYSQL (run the command)
R sudo service mysql stop

# close APACHE (run the command)
R sudo service apache2 stop

# kill NGINX server (we do not care, if it fails, run the command)
#R sudo nginx -s stop

# close MEMCACHED (run the command)
#sudo kill -9 `pidof memcached`

# copy HTTP server to cloud
C configuration/tools/HTTPServer.jar /mnt/HTTPServer.jar

# start HTTP server on port 8080, we can access results at folder /mnt
#R nohup java -jar /mnt/HTTPServer.jar 8080 10 /mnt true &
