diff --git a/system/bin/clear_cache.php b/system/bin/clear_cache.php
index 60ddbdb5..9c10b793 100644
--- a/system/bin/clear_cache.php
+++ b/system/bin/clear_cache.php
@@ -1,7 +1,8 @@
 <?php
 
 if(PHP_SAPI !== 'cli') {
-	die('This script can be run only in command line mode.');
+	echo 'This script can be run only in command line mode.';
+	exit(1);
 }
 
 require_once __DIR__ . '/../../common.php';
@@ -9,10 +10,9 @@ require_once SYSTEM . 'functions.php';
 require_once SYSTEM . 'init.php';
 
 if(clearCache()) {
-	echo 'Cache cleared.';
+	echo 'Cache cleared.' . PHP_EOL;
 }
 else {
-	echo 'Unexpected error.';
+	echo 'Unexpected error.' . PHP_EOL;
+	exit(2);
 }
-
-echo PHP_EOL;
\ No newline at end of file
diff --git a/system/bin/install_plugin.php b/system/bin/install_plugin.php
index c26578dc..27842e22 100644
--- a/system/bin/install_plugin.php
+++ b/system/bin/install_plugin.php
@@ -1,7 +1,8 @@
 <?php
 
 if(PHP_SAPI !== 'cli') {
-	die('This script can be run only in command line mode.');
+	echo 'This script can be run only in command line mode.';
+	exit(1);
 }
 
 require_once __DIR__ . '/../../common.php';
@@ -11,17 +12,20 @@ require_once SYSTEM . 'hooks.php';
 require_once LIBS . 'plugins.php';
 
 if($argc !== 2) {
-	exit('This command expects one parameter: zip file name (plugin)' . PHP_EOL);
+	echo 'This command expects one parameter: zip file name (plugin)' . PHP_EOL;
+	exit(2);
 }
 
 $path_to_file = $argv[1];
 $ext = strtolower(pathinfo($path_to_file, PATHINFO_EXTENSION));
 if($ext !== 'zip') {// check if it is zipped/compressed file
-	exit('Please install only .zip files.' . PHP_EOL);
+	echo 'Please install only .zip files.' . PHP_EOL;
+	exit(3);
 }
 
 if(!file_exists($path_to_file)) {
-	exit('ERROR: File ' . $path_to_file . ' does not exist' . PHP_EOL);
+	echo 'ERROR: File ' . $path_to_file . ' does not exist' . PHP_EOL;
+	exit(4);
 }
 
 if(Plugins::install($path_to_file)) {
@@ -30,9 +34,9 @@ if(Plugins::install($path_to_file)) {
 	}
 
 	$info = Plugins::getPlugin();
-	echo (isset($info['name']) ? $info['name'] . ' p' : 'P') . 'lugin has been successfully installed.';
+	echo (isset($info['name']) ? $info['name'] . ' p' : 'P') . 'lugin has been successfully installed.' . PHP_EOL;
+}
+else {
+	echo 'ERROR: ' . Plugins::getError() . PHP_EOL;
+	exit(5);
 }
-else
-	echo 'ERROR: ' . Plugins::getError();
-
-echo PHP_EOL;
\ No newline at end of file
diff --git a/system/bin/send_email.php b/system/bin/send_email.php
index be9ebf62..ee969522 100644
--- a/system/bin/send_email.php
+++ b/system/bin/send_email.php
@@ -1,7 +1,8 @@
 <?php
 
 if(PHP_SAPI !== 'cli') {
-	die('This script can be run only in command line mode.');
+	echo 'This script can be run only in command line mode.';
+	exit(1);
 }
 
 require_once __DIR__ . '/../../common.php';
@@ -9,7 +10,8 @@ require_once SYSTEM . 'functions.php';
 require_once SYSTEM . 'init.php';
 
 if($argc !== 3) {
-	exit('This command expects two parameters: account_name_or_id|player_name|email address, subject.' . PHP_EOL);
+	echo 'This command expects two parameters: account_name_or_id|player_name|email address, subject.' . PHP_EOL;
+	exit(2);
 }
 
 $email_account_name = $argv[1];
@@ -35,21 +37,25 @@ if(strpos($email_account_name, '@') === false) {
 			$email_account_name = $player->getAccount()->getEMail();
 		}
 		else {
-			exit('Cannot find player or account with name: ' . $email_account_name . '.' . PHP_EOL);
+			echo 'Cannot find player or account with name: ' . $email_account_name . '.' . PHP_EOL;
+			exit(3);
 		}
 	}
 }
 
 if(!Validator::email($email_account_name)) {
-	exit('Invalid E-Mail format.' . PHP_EOL);
+	echo 'Invalid E-Mail format.' . PHP_EOL;
+	exit(4);
 }
 
 if(strlen($subject) > 255) {
-	exit('Subject max length is 255 characters.' . PHP_EOL);
+	echo 'Subject max length is 255 characters.' . PHP_EOL;
+	exit(5);
 }
 
 if(!_mail($email_account_name, $subject, $message)) {
-	exit('Error while sending mail: ' . $mailer->ErrorInfo . PHP_EOL);
+	echo 'Error while sending mail: ' . $mailer->ErrorInfo . PHP_EOL;
+	exit(6);
 }
 
-echo 'Mail sent to ' . $email_account_name . '.' . PHP_EOL;
\ No newline at end of file
+echo 'Mail sent to ' . $email_account_name . '.' . PHP_EOL;