diff --git a/monkey_island/deb-package/DEBIAN/postinst b/monkey_island/deb-package/DEBIAN/postinst index 4dc1191b4..450c4cfdb 100644 --- a/monkey_island/deb-package/DEBIAN/postinst +++ b/monkey_island/deb-package/DEBIAN/postinst @@ -1,9 +1,16 @@ #!/bin/bash +MONKEY_FOLDER=/var/monkey_island INSTALLATION_FOLDER=/var/monkey_island/installation # install pip requirements -pip install -r /var/monkey_island/pip_requirements.txt --no-index --find-links file://$INSTALLATION_FOLDER +pip install -r $MONKEY_FOLDER/pip_requirements.txt --no-index --find-links file://$INSTALLATION_FOLDER -# remove installation folder +# remove installation folder and unnecessary files rm -rf $INSTALLATION_FOLDER +rm -f $MONKEY_FOLDER/pip_requirements.txt + +mv $MONKEY_FOLDER/ubuntu/* /etc/init/ + +service monkey-island start +service monkey-mongo start diff --git a/monkey_island/linux/monkey-island.service b/monkey_island/linux/kali/monkey-island.service similarity index 100% rename from monkey_island/linux/monkey-island.service rename to monkey_island/linux/kali/monkey-island.service diff --git a/monkey_island/linux/monkey-mongo.service b/monkey_island/linux/kali/monkey-mongo.service similarity index 100% rename from monkey_island/linux/monkey-mongo.service rename to monkey_island/linux/kali/monkey-mongo.service diff --git a/monkey_island/linux/ubuntu/monkey-island.conf b/monkey_island/linux/ubuntu/monkey-island.conf new file mode 100644 index 000000000..08c330d22 --- /dev/null +++ b/monkey_island/linux/ubuntu/monkey-island.conf @@ -0,0 +1,18 @@ +description "Monkey Island Service" + +start on runlevel [2345] +stop on runlevel [!2345] + +respawn +respawn limit unlimited + +script + chdir /var/monkey_island/cc + exec python main.py +end script + +post-stop script + if [ -n $UPSTART_EVENTS ]; then + exec sleep 15 + fi +end script \ No newline at end of file diff --git a/monkey_island/linux/ubuntu/monkey-mongo.conf b/monkey_island/linux/ubuntu/monkey-mongo.conf new file mode 100644 index 000000000..71abbf27d --- /dev/null +++ b/monkey_island/linux/ubuntu/monkey-mongo.conf @@ -0,0 +1,18 @@ +description "Monkey Island Mongo Service" + +start on runlevel [2345] +stop on runlevel [!2345] + +respawn +respawn limit unlimited + +script + chdir /var/monkey_island/ + exec /var/monkey_island/bin/mongodb/bin/mongod --dbpath db +end script + +post-stop script + if [ -n $UPSTART_EVENTS ]; then + exec sleep 15 + fi +end script \ No newline at end of file