addMessage('Attempting to restart OpenVPN', 'info'); exec('sudo /bin/systemctl stop openvpn-client@client', $return); exec('sudo /bin/systemctl enable openvpn-client@client', $return); exec('sudo /bin/systemctl start openvpn-client@client', $return); foreach ($return as $line) { $status->addMessage($line, 'info'); } $return = $status; $jsonData = ['return'=>$return]; echo json_encode($jsonData); }