Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code | Sign in
(1414)

Delta Between Two Patch Sets: DB/utils/restart.php

Issue 335100043: DB with histogram
Left Patch Set: Created 6 years, 4 months ago
Right Patch Set: DB Created 6 years, 2 months ago
Left:
Right:
Use n/p to move between diff chunks; N/P to move between comments. Please Sign in to add in-line comments.
Jump to:
Right: Side by side diff | Download
« no previous file with change/comment | « DB/utils/outError.txt ('k') | DB/utils/restart.sh » ('j') | no next file with change/comment »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
LEFTRIGHT
(no file at all)
1 <?php
2 //this programm is here to restart the daemons from the REST API (he works with restart.sh, runas.sh and sudo.sh), it is very complicated because we have to be root to restart services
3 //get the password from the user POST request
4 $password = $_POST["pass"];
5 //execute runas.sh [sudo.sh] [password] [student] [password] > outError.txt 2>&1 which means we first log as student user (because he is sudoer and by default w ith REST API we are connected with www-data which is not sudoer) so thanks to ru nas.sh, we run sudo.sh as student user.
6 $cmd1 = "/var/www/html/API_REST/utils/runas.sh \"/var/www/html/API_REST/utils/su do.sh ".$password."\" student ".$password . " > outError.txt 2>&1" ;
7 $output= shell_exec($cmd1);
8
9
10 //here we check if there is a mistake in outError.txt·
11 $cmd2 = "cat /var/www/html/API_REST/utils/outError.txt | grep -c failure";
12 $output= shell_exec($cmd2);
13 if ($output >= 1) {
14 echo "password error";
15 }
16 else{
17 echo "services restart";
18 }
19 ?>
LEFTRIGHT

Powered by Google App Engine
RSS Feeds Recent Issues | This issue
This is Rietveld f62528b