From 3a998739ff5013f2098d0882c48cbb80f00c616a Mon Sep 17 00:00:00 2001 From: necro-nemesis Date: Wed, 20 Mar 2019 11:15:44 -0400 Subject: [PATCH] systemctl thorough script --- includes/functions.php | 28 +++++++++++++++++++++++----- 1 file changed, 23 insertions(+), 5 deletions(-) diff --git a/includes/functions.php b/includes/functions.php index 2a31f66..88ba3fe 100755 --- a/includes/functions.php +++ b/includes/functions.php @@ -599,19 +599,37 @@ function SaveTORAndVPNConfig(){ } } elseif( isset($_POST['StartLokinet']) ) { echo "Attempting to start Lokinet"; - exec( 'sudo /home/pi/loki-network/lokinet > /dev/null &', $return ); -// header("Refresh:0"); + exec( 'sudo systemctl start lokinet' ); + + /* exec( 'pidof lokinet | wc -l', $lokinetstatus); + + if( $lokinetstatus[0] == 0 ) { + $status = '
Lokinet daemon is not running +
'; + } else { + $status = '
Lokinet is running +
'; + } + $arrConfig = array(); + foreach( $return as $a ) { + if( $a[0] != "#" ) { + $arrLine = explode( " ",$a) ; + $arrConfig[$arrLine[0]]=$arrLine[1]; + } + } +*/ + } elseif( isset($_POST['StopLokinet']) ) { echo "Attempting to stop Lokinet"; - exec( 'sudo kill -9 lokinet' ); + exec( 'sudo sytemclt stop lokinet' ); // location.reload(); } elseif( isset($_POST['GenerateLokinet']) ) { echo "Attempting to generate Lokinet"; - exec( '/home/pi/loki-network/lokinet -g start', $return ); + exec( 'sudo /home/pi/loki-network/lokinet -g > /dev/null &', $return ); // location.reload(); } elseif( isset($_POST['ReGenerateLokinet']) ) { echo "Attempting to regenerate Lokinet"; - exec( '/home/pi/loki-network/lokinet -g start', $return ); + exec( 'sudo /home/pi/loki-network/lokinet -g > /dev/null &', $return ); // //location.reload(); } }