| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103 |
- <?php
- $msg = "";
- if ( ($_SERVER["REQUEST_METHOD"] == "POST") && ( isset($_POST["disks"]) ) && ( isset($_POST["backup"]) ) ){
- $type = "";
- if ($_POST["backup"] == "differential backup"){
- $type = "Differential";
- } else {
- $type = "Incremental";
- }
- $msg = "Scheduled ".$type." Backup for disk(s): ";
- $pipe = popen('bconsole -c /var/www/bconsole.conf 2>&1 > /tmp/feedback', 'w');
- #2017-06-02 15:02:43
- $date = date('Y-m-d G:i:s', time()+60);
- # Schedule backup with bareos
- foreach ($_POST["disks"] as $backup) {
- if ( preg_match("/hdd\d+/", $backup) ){
- $msg .= "$backup, ";
- $cmd = "run job=\"Backup_archivo_to_LTO7\" fileset=\"archivo $backup\" level=\"".$type."\" client=\"archivo-fd\" pool=\"".$type."\" storage=\"LTO7\" priority=10 when=\"$date\" yes\n\r";
- fwrite($pipe, $cmd, strlen($cmd));
- #$msg .= $cmd;
- }
- }
- $msg .= "\n\r<br/>";
- pclose($pipe);
- } else {
- unset ($msg);
- }
- ?>
- <html>
- <head>
- <title>Deviproductions LTO7 Backup</title>
- <style type="text/css">
- form { display: table; background-image:url('pics/background.png'); padding:20px; border:4px solid #ddd; width: 200px; height: 300px }
- td, input, select, textarea { font-size:13px; font-family:Verdana,sans-serif; font-weight:bold; }
- input, select, textarea { color:#00c; }
- input { width: 190px; border: 2px solid black; border-radius: 4px; }
- select {
- width: 190px;
- height: 300px;
- box-sizing: border-box;
- border: 2px solid #ccc;
- border-radius: 10px;
- font-size: 16px;
- background-color: white;
- background-image: url('pics/hdd03.png');
- background-position: -2px 2px;
- background-repeat: no-repeat;
- padding: 5px 10px 5px 50px;
- }
- div {float: left;}
- .left, .right {display: table-cell}
- </style>
- <script type="text/javascript">
- function selectAll(selectBox,selectAll) {
- // have we been passed an ID
- if (typeof selectBox == "string") {
- selectBox = document.getElementById(selectBox);
- }
- // is the select box a multiple select box?
- if (selectBox.type == "select-multiple") {
- for (var i = 0; i < selectBox.options.length; i++) {
- selectBox.options[i].selected = selectAll;
- }
- }
- }
- </script>
- </head>
- <body>
- <?php
- if ( isset($msg) ) {
- print "<div>$msg</div>";
- }
- ?>
- <h1>Backup</h1>
- <form action="backup.php" method="post">
- <input type="hidden" name="type" value="incremental">
- <div class="left">
- <select id="selectbox" name="disks[]" multiple>
- <?php
- for ($i=1;$i<=40;$i++){
- $disk = sprintf("hdd%02d", $i);
- echo "<option value=\"$disk\">$disk</option>";
- }
- ?>
- </select>
- </div>
- <div class="right">
- <input type="button" name="Button" value="alle auswählen" onclick="selectAll('selectbox',true)" />
- <input type="button" name="Button" value="keine auswählen" onclick="selectAll('selectbox',false)" />
- <input type="submit" name="backup" value="incremental backup">
- <input type="submit" name="backup" value="differential backup">
- <div/>
- </form>
- <div class="2row">
- </div>
- </body>
- </html>
|