5/29/2019

Axapta :: Axapta คำสั่งผลิต End ไม่ได้

Axapta :: Axapta คำสั่งผลิต End ไม่ได้
PD18-01456 : 378010712412 : SO18-460

ตรวจสอบพบ
1. มี Parts 901560712068 ไม่ถูกต้อง ใน Transaction ที่ PD เดียวกัน
2. Status ของ PD ไม่ถูกต้อง มีการ Reports และ UpCoseting ไปแล้วแต่ Status ยังเป็น Start อยู่

1. มี Parts 901560712068 ไม่ถูกต้อง ใน Transaction ที่ PD เดียวกัน ตรวจดูใน Picking List แล้วตัด Code 901560712068 ครบแล้ว
แต่ Transaction นี้เกินขึ้นมา
ทำให้ จะ Report ยอดเป็น 0 หรือ End คำสั่งผลิตมี Error ยอดของ Code ที่จะตัดไม่พอตามรูป

วิธีแก้
1.1.แก้ไขโดย ลบ Transaction ทิ้งที่ MS SQL Server ทิ้ง
  1. SELECT     *
  2. FROM         INVENTTRANS
  3. WHERE     (ITEMID = '901560712068') AND (TRANSREFID LIKE '%PD18-019456') 

1.2.Run Job recalcInventSum ใส่ Code ในข้อ 1. เข้าไป จะมีการ Update Onhand ให้ถูกต้อง
2. Status ของ PD ไม่ถูกต้อง มีการ Reports และ UpCoseting ไปแล้วแต่ Status ยังเป็น Start อยู่
ที่จริง Status ของ PD นี้ มีการ Reports และ Update Costing ไปแล้ว Status ที่ถูกต้องจะต้องเป็น
Status : Reported as finished
Remain Status : Costing
แต่ตามรูป Status ไม่ถูกต้องทำให้ End ไม่ได้
วิธีแก้
2.1. แก้ Status ของ PD ที่ MS SQL Server
  1. SELECT     *
  2. FROM         PRODTABLE
  3. WHERE     (PRODID LIKE '%PD18-019456')

แก้
ProdStatus จาก 4 ให้เป็น 5
BackOrderStatus จาก 1 ให้เป็น 4
Status ของ PD จะเปลี่ยนเป็นอันที่ถูกต้อง
2.2. Update คำสั่งผลิต ติ๊ก End และ ติ๊ก Reports
คำสั่งผลิตก็จะ End ให้

Axapta :: Error Post PO Invoice

Axapta :: Error Post PO Invoice
Error in unit of amount in currency 'US2'. Must be rounded to ' '.
Unit of 1,289.79 1,289.79 being posted to account '1110600' is too little.

เกิดจาก
- ค่าใน LineAmount มีทศนิยมมากเกินไป ต้องใส่แค่ 2 ตำแหน่ง

ค่าที่เห็นใน Line แสดง 2 ตำแหน่อง แต่ค่าจริง ๆ ใน Table มีทศนิยมมากกว่า 2 ตำแหน่งทำให้ Post Invoice ไม่ผ่านและ Error
แก้โดย Copy ค่าที่เป็น ใส่แทนค่าเดิม ทศนิยมก็จะหายไป

แก้โปรแกรม SetCourier ให้ปัดทศนิยมเป็น 2 ตำแหน่ง
แก้โปรแกรม
- ก่อนใส่ค่าลงใน Line Amount ให้ปัดทศนิยมให้เหลือ 2 ตำแหน่งก่อน
Code
  1. purchLineUpdate.LineAmount = DecRound(LineAmountSet, 2);

ค่าที่แสดงใน Line จะเห็นทศนิยมแค่ 2 ตำแหน่งแต่ค่าจริง ๆ ใน table ผ่าน MS SQL จะมีทศนิยมเยอะทำให้ Error

Home Assistant :: Server Switch ใช้กรณี ปิดเปิด Air Manual

Home Assistant :: Server Switch ใช้กรณี ปิดเปิด Air Manual เมื่อ MN-Server ไม่ทำงานหรือสั่งการไม่ได้ (สถานะต้องปิดไว้ถ้าเปิดจะเปิด 2 เครื่องพร้อมกัน)

http://192.168.2.200:8123/




มีไว้สำหรับปิด หรือ เปิด Air Manual เมื่อ MN-Server ไม่ทำงาน หรือสั่งงานไม่ได้
1. ROOM_A_ON_OFF (ไว้ปิดเปิด Air ตึกหน้า เปิดจะเปิดทั้งสองตัว เพราะมี PI เครื่องเดียว สั่ง GPI อันเดียว)
  1. nano /home/homeassistant/.homeassistant/configuration.yaml

  1.  - platform: mqtt
  2.     name: "ROOM_A_ON_OFF"
  3.     state_topic: "hass/state/ROOM_A_ON_OFF"
  4.     command_topic: "hass/cmd/ROOM_A_ON_OFF"
  5.     payload_on: "ON"
  6.     payload_of: "OFF"
  7.     retain: true

ใช้ Service ที่เครื่อง Raspberry PI ในการรับส่ง mqtt ชื่อ ROOM_A_ON_OFF
Code ที่เครื่อง PI
  1. nano /home/pi/mqttAir.py

  1.  
  2. #!/usr/bin/python
  3. # -*- coding: utf-8 -*-
  4.  
  5. # Copyright (c) 2010-2013 Roger Light <roger@atchoo.org>
  6. #
  7. # All rights reserved. This program and the accompanying materials
  8. # are made available under the terms of the Eclipse Distribution License v1.0
  9. # which accompanies this distribution.
  10. #
  11. # The Eclipse Distribution License is available at
  12. #   http://www.eclipse.org/org/documents/edl-v10.php.
  13. #
  14. # Contributors:
  15. #    Roger Light - initial implementation
  16. # Copyright (c) 2010,2011 Roger Light <roger@atchoo.org>
  17. # All rights reserved.
  18.  
  19. # This shows a simple example of an MQTT subscriber.
  20.  
  21. #import context  # Ensures paho is in PYTHONPATH
  22. import paho.mqtt.client as mqtt
  23.  
  24. ### PI ###
  25. import RPi.GPIO as GPIO                 #Add the GPIO library to a Python sketch
  26. import time                             #Add the time library to a Python sketch
  27. GPIO.setwarnings(False)
  28. GPIO.setmode(GPIO.BOARD)                #Setup GPIO using Board numbering
  29. GPIO.setup(16, GPIO.OUT)
  30.  
  31. ### Piface ###
  32. import pifacedigitalio
  33. pf = pifacedigitalio.PiFaceDigital()
  34.  
  35. def on_connect(mqttc, obj, flags, rc):
  36.     print("rc: " + str(rc))
  37.  
  38. def on_message(mqttc, obj, msg):
  39.     print(msg.topic + " " + str(msg.qos) + " " + str(msg.payload))
  40.     mqttc.publish("hass/state/ROOM_A_ON_OFF", str(msg.payload), 0, True)
  41. ## ON OFF ##
  42.    if str(msg.payload) == "ON":
  43.         #GPIO.output(16,GPIO.HIGH)
  44.         pf.relays[1].turn_on()
  45.         pf.relays[0].turn_on()
  46.     else:
  47.         pf.relays[1].turn_off()
  48.         pf.relays[0].turn_off()
  49.         #GPIO.output(16,GPIO.LOW)
  50.  
  51. def on_publish(mqttc, obj, mid):
  52.     print("mid: " + str(mid))
  53.  
  54. def on_subscribe(mqttc, obj, mid, granted_qos):
  55.     print("Subscribed: " + str(mid) + " " + str(granted_qos))
  56.  
  57. def on_log(mqttc, obj, level, string):
  58.     print(string)
  59.  
  60. # If you want to use a specific client id, use
  61. # mqttc = mqtt.Client("client-id")
  62. # but note that the client id must be unique on the broker. Leaving the client
  63. # id parameter empty will generate a random id for you.
  64. mqttc = mqtt.Client()
  65. mqttc.on_message = on_message
  66. mqttc.on_connect = on_connect
  67. mqttc.on_publish = on_publish
  68. mqttc.on_subscribe = on_subscribe
  69. # Uncomment to enable debug messages
  70. # mqttc.on_log = on_log
  71. mqttc.connect("192.168.2.200", 1883, 60)
  72. mqttc.subscribe("hass/cmd/ROOM_A_ON_OFF", 0)
  73.  
  74. mqttc.loop_forever()
  75.  
  76.  


Run เป็น Service
https://intranet.sci.com/blog.php?u=281&b=1583
Service
  1. sudo python /home/pi/mqttAir.py

ไว้รับคำสั่ง mqtt และสั่งเปิด Air ตาม Code

****** หมายเหตุ บางครั้งสั่งแล้วไม่ปิดไม่เปิด Service อาจจะค้าง ต้อง Restart Service ใหม่ หรือ Reboot เครื่อง PI ใหม่ *******

2. ROOM_B_ON_OFF (รอติดตั้ง ห้อง Server ตึกหลัง)

PHP :: Function แปลง Bytes เป็น MB, GB, KB

PHP :: Function แปลง Bytes เป็น MB, GB, KB

  1.  
  2. function formatSizeUnits($bytes)
  3. {
  4.     if($bytes >= 1073741824){
  5.     $bytes = number_format($bytes / 1073741824, 2) . ' GB';
  6.    } elseif($bytes >= 1048576){
  7.       $bytes = number_format($bytes / 1048576, 2) . ' MB';
  8.    } elseif ($bytes >= 1024){
  9.       $bytes = number_format($bytes / 1024, 2) . ' KB';
  10.    } elseif ($bytes > 1){
  11.       $bytes = $bytes . ' bytes';
  12.    } elseif ($bytes == 1){
  13.       $bytes = $bytes . ' byte';
  14.    } else {
  15.       $bytes = '-';
  16.    }
  17. return $bytes;
  18. }//Close Functions.
  19.  


ตัวอย่าง
https://intranet.sci.com/sci/CheckServer/check_start.php

https://stackoverflow.com/questions/5501427/php-filesize-mb-kb-conversion/5501447

Code Arduino ESP8266 SCI Smart Farm

Code Arduino ESP8266 SCI Smart Farm
- Connect Wifi
- อ่านค่าความชื้น
- ส่งค่า Home Assistant (192.168.0.202) --> Home Assistant ทำ Auto Scrip สั่งปิดเปิด SunOff อีกที

  1. #include <ESP8266WiFi.h>
  2. #include <PubSubClient.h>
  3.  
  4. // Update these with values suitable for your network.
  5. const char* ssid = "xxxxxx";
  6. const char* password = "xxxxxx";
  7. const char* mqtt_server = "192.168.2.202";
  8. int sensorPin = A0; // select the input pin for the potentiometer
  9. int sensorValue = 0; // variable to store the value coming from the sensor
  10.  
  11. WiFiClient espClient;
  12. PubSubClient client(espClient);
  13. long lastMsg = 0;
  14. char msg[50];
  15. int value = 0;
  16. char output;
  17. unsigned long seconds = 1000L; //Notice the L
  18. unsigned long minutes = seconds * 60;
  19.  
  20. void setup() {
  21.   pinMode(BUILTIN_LED, OUTPUT);     // Initialize the BUILTIN_LED pin as an output
  22.   Serial.begin(115200);
  23.   setup_wifi();
  24.   client.setServer(mqtt_server, 1883);
  25.   client.setCallback(callback);
  26.    
  27. }
  28.  
  29. void setup_wifi() {
  30.  
  31.   delay(10);
  32.   // We start by connecting to a WiFi network
  33.   Serial.println();
  34.   Serial.print("Connecting to ");
  35.   Serial.println(ssid);
  36.  
  37.   WiFi.begin(ssid, password);
  38.  
  39.   while (WiFi.status() != WL_CONNECTED) {
  40.     delay(500);
  41.     Serial.print(".");
  42.   }
  43.  
  44.   Serial.println("");
  45.   Serial.println("WiFi connected");
  46.   Serial.println("IP address: ");
  47.   Serial.println(WiFi.localIP());
  48. }
  49.  
  50. void callback(char* topic, byte* payload, unsigned int length) {
  51.   Serial.print("Message arrived [");
  52.   Serial.print(topic);
  53.   Serial.print("] ");
  54.   for (int i = 0; i < length; i++) {
  55.     Serial.print((char)payload[i]);
  56.   }
  57.   Serial.println();
  58.  
  59.   // Switch on the LED if an 1 was received as first character
  60.   if ((char)payload[0] == '1') {
  61.     digitalWrite(BUILTIN_LED, LOW);   // Turn the LED on (Note that LOW is the voltage level
  62.     // but actually the LED is on; this is because
  63.     // it is acive low on the ESP-01)
  64.   } else {
  65.     digitalWrite(BUILTIN_LED, HIGH);  // Turn the LED off by making the voltage HIGH
  66.   }
  67.  
  68. }
  69.  
  70. void reconnect() {
  71.  
  72.   // Loop until we're reconnected
  73.   while (!client.connected()) {
  74.     Serial.print("Attempting MQTT connection...");
  75.     // Attempt to connect
  76.     //client.connect(clientName, username, password )
  77.     if (client.connect("ESP8266Client","sci", "x1x2x3")) {
  78.       Serial.println("connected");
  79.       // Once connected, publish an announcement...
  80.       client.publish("outTopic", "connected MQTT");
  81.       // ... and resubscribe
  82.       client.subscribe("inTopic");
  83.     } else {
  84.       Serial.print("failed, rc=");
  85.       Serial.print(client.state());
  86.       Serial.println(" try again in 5 seconds");
  87.       // Wait 5 seconds before retrying
  88.       delay(5000);
  89.     }
  90.   }
  91. }
  92. void loop() {
  93.  
  94.   if (!client.connected()) {
  95.     reconnect();
  96.   }
  97.   client.loop();
  98.   // 1000 = 1s
  99.   //1 hour
  100.   //delay(60UL * 60UL * 1000UL);  //60 minutes each of 60 seconds each of 1000 milliseconds all unsigned longs
  101.   //delay(20000);
  102.  
  103.   long now = millis();
  104.   if (now - lastMsg > 3000) {
  105.     lastMsg = now;
  106.     //read the value from the sensor:
  107.     sensorValue = analogRead(sensorPin);
  108.     Serial.print("sensor = " );
  109.     Serial.println(sensorValue);
  110.     sprintf (msg,"%d", sensorValue);
  111.     client.publish("garden/moisture", msg);
  112.   }  
  113.  
  114. }

PHP : PHP Get Data From Axapta DB

PHP : PHP Get Data From Axapta DB
1. db.php
2. config.php
3. FileGet.php

1. db.php
<?php
class MysqlDB{
var $Host="";
var $User="";
var $Password="";
var $DB="";
var $ShowError="";
var $LinkID="";
var $Result="";
var $NumRows="";
var $NumFields="";

function MysqlDB($Host,$User,$Password,$DB,$ShowError){
    $this->Host=$Host;
    $this->User=$User;
    $this->Password=$Password;
    $this->DB=$DB;
    $this->ShowError=$ShowError;
    if($this->ShowError){
        error_reporting (E_ALL ^ E_NOTICE);
    }else{
        error_reporting (E_ALL ^ (E_NOTICE | E_WARNING));
    }
}

function Connect(){
    if(empty($this->LinkID)){
        $this->LinkID=@mysql_connect($this->Host,$this->User,$this->Password);
//        $this->Result=@mysql_db_query($this->DB,"SET NAMES tis620");
        if(empty($this->LinkID)){
            exit;
        }
    }
}

function Query($Sql){
    $this->Connect();
    @mysql_db_query($this->DB,"SET NAMES tis620");
    $this->Result=@mysql_db_query($this->DB,$Sql);
    $Error=mysql_error();
    if($Error and $this->ShowError){
        echo $Error."<br>".$Sql;
        exit;
    }
    $this->NumRows=mysql_num_rows($this->Result);
    $this->NumFields=mysql_num_fields($this->Result);
    return $this->NumRows;
}

function Update($Sql){
    $this->Connect();
    @mysql_db_query($this->DB,"SET NAMES tis620");
    @mysql_db_query($this->DB,$Sql);
    $Error=mysql_error();
    if($Error and $this->ShowError){
        echo $Error."<br>".$Sql;
        exit;
    }
}

function GetRow(){
    return mysql_fetch_array($this->Result);
}

function DataSeek($i){
    return mysql_data_seek($this->Result,$i);
}

function GetObject(){
    return mysql_fetch_object($this->Result);
}

function LastID(){
    return mysql_insert_id($this->LinkID);
}

function FieldName($FieldNumber){
    return mysql_field_name($this->Result,$FieldNumber);
}

}
?>

2. config.php
<?php
//MS SQL Config.
$MSServer = "xxxxx";
$MSUser = "xxx";
$MSPass = "xxxx";
$MSDB = "xxxxx";

//connection to the database
$dbhandle = mssql_connect($MSServer, $MSUser, $MSPass)
  or die("Couldn't connect to SQL Server on $MSServer");

//select a database to work with
$selected = mssql_select_db($MSDB, $dbhandle)
  or die("Couldn't open database ".$MSDB);
 
//MySQL Config. 
$Host="localhost";
$User="xxxxx";
$Password="xxxxx";
$DB="xxxx";
$ShowError=0;

?>
3. FileGet.php
<?php
    include_once("config.php");
    include_once("db.php");
   
    $myDB    = new MysqlDB($Host,$User,$Password,$DB,$ShowError);
    echo "Update Data From Axapta To Phpmyadmin.";

    //echo "<td align='center'>Update Data From Axapta To Phpmyadmin.</td>";

    $query  = "SELECT RefRecId, CONVERT(VARCHAR(10), TransDate, 120) AS TransDate, JournalId, CostAmount, AccountNum, AccountName, Department, Txt, CheckType";
    $query .= " FROM SCI_TmpMIToPhp ";
    //$query .= " WHERE purchLine.RecId = '".$RecId."' ";
    $result = mssql_query($query) or die("Couldn't query");
    $mssqlRows = mssql_num_rows($result);
    if($mssqlRows > 0){
        $row = mssql_fetch_array($result);
    }
    //mssql_free_result($result);
    //echo $row["JournalId"];
   
    //Loop display the results
    while($row = mssql_fetch_array($result))
    {
          //echo "<li>" . $row["JournalId"] . " : ". $row["TransDate"] ." : ". $row["Department"] ." : ". $row["ItemId"] ."</li>" ;
          //$TransDate = date_format($row["TransDate"], "Y-m-d");
          //$SQL .= " WHERE ( AccountNum = '1111000' OR AccountNum = '1111001' OR AccountNum = '1111200' OR AccountNum = '1111500')";
          $AccountNum = $row["AccountNum"];
          $Txt = $row["Txt"];
        if($AccountNum == 1111000 || $AccountNum == 1111001 || $AccountNum == 1111200 || $AccountNum == 11111500){
            $ItemId = substr($Txt, 0, 12);
            $LenTxt = strlen($Txt);
            $Txt = substr($Txt, 15, $LenTxt);          
        } else {
            $ItemId = "";
        }        
        
       $SQL = " INSERT INTO sci_consume_chart.Data (RefRecId, TransDate , JournalId, AccountNum, AccountName, ItemId, Txt, Amount, Department, CheckType)";
        $SQL.= " VALUES ('".$row["RefRecId"]."', '".$row["TransDate"]."', '".$row["JournalId"]."', '".$AccountNum."','".$row["AccountName"]."','".$ItemId."','".$Txt."','".$row["CostAmount"]."','".$row["Department"]."','".$row["CheckType"]."')";          
        //echo $SQL;
        $myDB->Update($SQL);
    }

    echo "<br><br><font color='green'> Update Data Finish. Please Close This Page.</font>";
?>

Ubuntu :: Create Cer Intranet

Ubuntu :: Create Cer Intranet
เครื่องเดียว Run 2 Cer intranet.sci.com และ intranet.scivalve.com ต่างกันแค่ชื่อไฟล์

1. Run Code Create Cer.
  1. openssl req -new -x509 -sha256 -days 3650 -nodes -out /etc/apache2/ssl/intranet.sci.com.pem -keyout /etc/apache2/ssl/intranet.sci.com.key

  1. /etc/apache2/ssl# openssl req -new -x509 -sha256 -days 3650 -nodes -out /etc/apache2/ssl/intranet.sci.comvalve.pem -keyout /etc/apache2/ssl/intranet.scivalve.com.key


2. ใส่ข้อมูล
Generating a 1024 bit RSA private key
.........++++++
...++++++
writing new private key to '/etc/apache2/ssl/intranet.scivalve.com.key'
-----
You are about to be asked to enter information that will be incorporated
into your certificate request.
What you are about to enter is what is called a Distinguished Name or a DN.
There are quite a few fields but you can leave some blank
For some fields there will be a default value,
If you enter '.', the field will be left blank.
-----
Country Name (2 letter code) [AU]:TH
State or Province Name (full name) [Some-State]:
Locality Name (eg, city) []:
Organization Name (eg, company) [Internet Widgits Pty Ltd]:SCICORPORATION
Organizational Unit Name (eg, section) []:
Common Name (eg, YOUR name) []:intranet.scivalve.com
Email Address []:suwit@scivalve.com


3. Restart apache

ได้ไฟล์ key, pam ไปใช้งานต่อ อยู่ที่
  1. /etc/apache2/ssl

ระบบรดน้ำ อัตโนมัติ ด้วยการวัดความชื้น การใช้งานเบื้องต้น

ระบบรดน้ำ อัตโนมัติ ด้วยการวัดความชื้น การใช้งานเบื้องต้น
อุปกรณ์ที่ติดตั้ง
ตัววัดความชื้น

ตู้ Control (ฝซร. ติดตั้งให้)


นำไปติดตั้งที่สวนตรงศาลเพื่อลดน้ำหญ้าอัตโนมัติ เมื่อพื้นดินตรงที่วัดแห้งก็จะลดน้ำ เมื่อชุ่มได้ที่ได้จะปิดน้ำ อัตโนมัติ

การสั่งงานผ่านหน้า Web
1. เข้าสั่งงานผ่านหน้า Web หรือ Smartphone ได้ เข้าไปที่
http://192.168.2.202:8123

2. ใส่ User Name และ รหัสที่ตั้งค่าไว้

3. เมื่อใส่รหัสถูกจะเข้าสู่หน้าจอหลัก
3.1. เปิดใช้งานตัววัดความชื่นด้วยการเปิด Switch Moisture Mode เป็นตัวอ่านค่าและรับความชื้น และส่งไปแสดงผลเมนูด้านบน
เมื่อความชื้นถึงระดับที่ตั้งไว้ ก็จะเปิด และปิดอัตโนมัติ

3.2. ถ้าต้องการเปิด หรือปิด Manual สามารถเปิด Switch Sonoff Shrine ได้เลย
3.3. หรือต้องการเปิดที่ตัวเครื่องสามารถเดินไปเปิดที่ตู้ Control ตรงหน้าศาลแล้วกดปุ่ม เพื่อเปิดและปิดก็ได้

Axapta :: Run PHP File

Axapta :: Run PHP File

//IE
  1. WinAPI::shellExecute("IEXPLORE.EXE", "https://intranet.sci.com/sci/AF/Used/GetDataFromAX.php");

//FireFox
  1. WinAPI::shellExecute("FIREFOX.EXE", "https://intranet.sci.com/sci/AF/Used/GetDataFromAX.php");


http://kdynamics.blogspot.com/2012/11/run-external-application-from-dynamics.html

Code Python ส่ง Slack ใหม่

Code Python ส่ง Slack ใหม่
Code เดิมส่งรูปสุดท้าย บางครั้งได้รูปว่าง
แก้ Code ใหม่เอารูปที่ 4 นับจากที่ Video มีการบันทึก
แล้วลบ jpg ทิ้ง
  1.  
  2. from slackclient import SlackClient
  3.  
  4. sc = SlackClient("xoxb-XXXXXXX")
  5.  
  6. import glob
  7. import os
  8.  
  9. #list jpg to array
  10. list_of_files = glob.glob('/home/pi/Pictures/*.jpg')
  11. if len(list_of_files) > 4:
  12.   file_select = list_of_files[4]
  13.   with open(file_select) as file_content:
  14.        sc.api_call(
  15.          "files.upload",
  16.          channels="CF6GEHBDF",
  17.          file=file_content,
  18.          title="IP Camera Room A 192.168.2.133."
  19.        )
  20. #delete jpg
  21. for i in glob.glob("/home/pi/Pictures/*.jpg"):
  22.   os.remove(i)

IP Camera Vstarcam + Mostion Record + Send Slack

IP Camera Vstarcam + Mostion Record + Send Slack

กล้อง
1. ติดตั้ง App Eye4 ตามคู่มือ
2. ต่อ Lan หรือ Wifi ให้ออกเน็ตตรงได้ ครั้งแรกเพื่อให้ใช้งานได้
3. Scan Qrcode ที่ใต้แทน
4. ใส่รหัส 888888
5. ตั้งรหัสใหม่ ตามที่ต้องการ User เป็น admin
6. Add เข้า App แบบ Manual จด Mac Address ไว้
7. ย้ายเข้า วง 0 รับ DHCP
8. ที่เครื่อง Com Linux Scan หา Port
ตัดตั้งโปรแกรม nmap
9. Run คำสั่งที่ User sa เท่านั้น root ใช้ไม่ได้
ใช้คำสั่ง
  1. nmap -p- IP
เช่น nmp -p- 192.168.0.207
Starting Nmap 7.60 ( https://nmap.org ) at 2019-04-11 09:44 +07
Nmap scan report for 192.168.0.207
Host is up (0.0092s latency).
Not shown: 65531 closed ports
PORT STATE SERVICE
9600/tcp open micromuse-ncpw
10080/tcp open amanda
10544/tcp open MOS-soap-opt
60340/tcp open unknown


ใช้ port ที่เป็น unknown
10. เข้า Webbrowser IP และ Port
192.168.0.207:60340

Port จะ เปลี่ยนไปเรื่อย ๆ เมื่อ Reboot กล้อง จะใช้งานต้องเอา DHCP ออก Fix IP และ Port ไปเลยจะได้ไม่เปลี่ยน

11. แสดงข้อมูลผ่านหน้า web แบบใส่รหัสไปด้วย
http://##:###@192.168.0.207:60340/videostream.cgi?user=##&pwd=###
## = user
### = pwd
ที่ตั้งในข้อ 5.

12. นำไปแสดงที่ HA แก้ configuration.yaml
เพิ่ม ใน panel_iframe:
  1.  camera2:
  2.     title: 'Camera207'
  3.     url: 'http://##:###@192.168.0.207:60340/videostream.cgi?user=##&pwd=###'
  4.  
  5.   camera3:
  6.     title: 'Camera195'
  7.     url: 'http://##:###@192.168.0.195:46992/videostream.cgi?user=##&pwd=###'

แสดงผลได้
Link เพิ่มเติม
https://community.home-assistant.io/t/vstarcam-installation/68264

***ก่อน Config Fix IP ของกล้องและ Port ให้เรียบร้อย ก่อนทำ ***
13. ที่เครื่อง pi ติดตั้ง motion
  1. sudo apt-get install motion
  2. locale-gen en_US en_US.UTF-8 th_TH th_TH.UTF-8


14. Config Motion
ใช้ netcam_url อ่าน Video จาก Camera IP Vstarcam
ที่มา https://itworldexplorer.blogspot.com/2017/08/rtsp-ip-motion.html
หรือ https://www.youtube.com/watch?v=Z_aumd75CU4
*** Backup motion.conf เดิมไว้ก่อนเสมอ ***
แก้ดังนี้
  1. nano /etc/motion/motion.comf

width 640
height 480
framerate 10
netcam_url http://192.168.2.133:8080/videostream.cgi?user=##&pwd=###
netcam_userpass ##:### #user:pwd
netcam_keepalive on
threshold 1
noise_level 24
noise_tune off
event_gap 0
ffmpeg_output_movies on #บันทึก Video ด้วย ไว้ส่งเก็บ Qnap
locate_motion_mode on
locate_motion_style redbox #สีที่จะให้ครอบตอน motion
text_changes on
target_dir /home/pi/Pictures #ที่เก็บไฟล์
stream_port 0
webcontrol_port 0
on_picture_save if [ ! -z "$(ls %f|grep 4.jpg)" ]; then mutt -s "Motion detectted" suwit.jph@gmail.com -a "%f" < /dev/null; fi #ใส่ Code เพื่อให้ส่งเมล์

แล้ว Save

15. แก้ rc.local
nano /etc/rc.local
ใส่ Cod ก่อน exit 0
find /home/pi/.thumbnails/normal/.|xargs rm&
rm /home/pi/sent&
sudo rm /var/mail/pi&


16. Test run คำสั่ง
  1. motion

เปิด Termenal ขึ้นมาอีกอันดู Log เวลามีการเคลื่อนไหวจะ Save รูป
  1. tail /var/log/motion/motion.log

/var/log/motion/motion.log
[1] [WRN] [NET] [Apr 11 15:54:06] netcam_next: called with no data in buffer
[1] [WRN] [NET] [Apr 11 15:54:06] netcam_next: called with no data in buffer
[1] [NTC] [EVT] [Apr 11 15:54:10] event_new_video FPS 4
[1] [NTC] [EVT] [Apr 11 15:54:10] event_newfile: File of type 8 saved to: /home/pi/Pictures/01-20190411155410.avi
[1] [NTC] [ALL] [Apr 11 15:54:10] motion_detected: Motion detected - starting event 1
[1] [NTC] [EVT] [Apr 11 15:54:11] event_newfile: File of type 1 saved to: /home/pi/Pictures/01-20190411155410-02.jpg
[1] [NTC] [NET] [Apr 11 15:54:11] netcam_read_html_jpeg: Potential split boundary - 4095 chars flushed, 1 re-positioned
[1] [NTC] [EVT] [Apr 11 15:54:11] event_newfile: File of type 1 saved to: /home/pi/Pictures/01-20190411155411-00.jpg
[1] [NTC] [EVT] [Apr 11 15:54:12] event_newfile: File of type 1 saved to: /home/pi/Pictures/01-20190411155412-00.jpg
[1] [NTC] [ALL] [Apr 11 15:54:13] motion_loop: End of event 1


17. ได้รูป และ Video
18. เขียน Code ส่ง Slack และ Backup เก็บที่ Qnap
  1. nano slack_post.py

from slackclient import SlackClient

sc = SlackClient("Pass Slack Client")

import glob
import os
import time

time.sleep(3) # Delays for 5 seconds. You can also use a float value.

list_of_files = glob.glob('/home/pi/Pictures/*.jpg')
latest_file = max(list_of_files, key=os.path.getctime)


with open(latest_file) as file_content:
sc.api_call(
"files.upload",
channels="CF6GEHBDF",
file=file_content,
title="IP Camera Room A 192.168.2.133."
)


19. เขียน Code backup ไป Qnap และลบ .jpg
nano backup_camera.sh

### backup_camera.sh ###
#!/bin/bash
date_2dayago=`date -d "1 day ago 13:00" '+%Y-%m-%d'`
date_yesterday=`date -d "yesterday 13:00" '+%Y-%m-%d'`
date_today=`date '+%Y-%m-%d'`
mkdir $date_yesterday
find /home/pi/Pictures -type f -name '*.avi' -newermt $date_2dayago ! -newermt $date_today -exec mv -t $date_yesterday {} +
tar -czf if_$date_yesterday.tar.gz $date_yesterday
mv 192.168.2.133_$date_yesterday.tar.gz /home/pi/backup
rm -r $date_yesterday


20. ตั้ง Crontab ให้ทำงาน
  1. 0 6 * * * bash /home/pi/backup_camera.sh
  2. 0 7 * * * rm /home/pi/Pictures/*.jpg


ตัวอย่างเพิ่มเติม [url]https://intranet.sci.com/blog.php?u=281&b=1667
[/url]

21. แก้ motion.conf เพิ่มเติม ใส่ ส่ง Slack และ ให้ Run Dimond Service
  1. nano /etc/motion/motion.conf

on_movie_start python /home/pi/slack_post.py
daemon on

  1. nano /etc/default/motion

start_motion_daemon=yes


22. สั่งให้ Run Service
  1. sudo service motion start
  2. sudo service motion restart


ลอง tail log ดูว่า service ทำงานหรือไม่
  1. tail /var/log/motion/motion.log

Windows 10 : update 1809 RDP ไม่ได้ Check Config Show Status Not Supportd

Windows 10 : update 1809 RDP ไม่ได้ Check Config Show Status Not Supportd

Run RDP Wrapper เหมือนที่เคยทำแล้วไม่หาย

วิธีแก้
1. Run CMD Admin run command.
  1. net stop TermService


For 10.0.17134.706 you need:
2. Run Notepad as an administrator > open ini file C:\Program Files\RDP Wrapper\rdpwrap.ini and paste text in last line :

[10.0.17134.706-SLInit]
bServerSku.x64 =F1378
lMaxUserSessions.x64 =F137C
bAppServerAllowed.x64 =F1380
bInitialized.x64 =F2430
bRemoteConnAllowed.x64=F2434
bMultimonAllowed.x64 =F2438
ulMaxDebugSessions.x64=F243C
bFUSEnabled.x64 =F2440

[10.0.17134.706]
LocalOnlyPatch.x64=1
LocalOnlyOffset.x64=92521
LocalOnlyCode.x64=jmpshort
SingleUserPatch.x64=1
SingleUserOffset.x64=1511C
SingleUserCode.x64=Zero
DefPolicyPatch.x64=1
DefPolicyOffset.x64=10E78
DefPolicyCode.x64=CDefPolicy_Query_edi_rcx
SLInitHook.x64=1
SLInitOffset.x64=22F5C
SLInitFunc.x64=New_CSLQuery_Initialize


There must be an empty line at the end!
3. uninstall update kb4493464.
Open CMD and run command:
wusa /uninstall /kb:4493464

and reboot.
4. For disable updates I'm use utility
https://www.sordum.org/9470/windows-update-blocker-v1-1/
If your system is automatically updated you will lose access again.

5. Run command in cmd.
  1. net start TermService

https://github.com/stascorp/rdpwrap/issues/741

Zimbra 8.8.11 : zmbkpose backup not send mail notification. When backup complete.

Zimbra 8.8.11 : zmbkpose backup not send mail notification. When backup complete.
Error Log :
/usr/bin/zmbkpose: line 146: /opt/zimbra/postfix/sbin/sendmail: No such file or directory

The path to sendmail was change on zimbra 8.7 version from:
/opt/zimbra/postfix/sbin/sendmail
to:
/opt/zimbra/common/sbin/sendmail


https://github.com/bggo/Zmbkpose/issues/68

Edit zmbkpose change path.
  1. nano /usr/bin/zmbkpose

Zimbra 8.6.0 Upgrade To Zimbra 8.8.11 Ubuntu 14.04

Zimbra 8.6.0 Upgrade To Zimbra 8.8.11 Ubuntu 14.04

***สำคัญ จะ Upgrade จาก 8.6 ไปเป็น 8.8 เลยไม่ได้ ไม่ผ่าน Error หลายอย่าง ต้อง Upgrad จาก 8.6 --> 8.7 --> 8.8 ถึงจะผ่าน ***
1. ทำ Snapshots ไว้ และมั่นใจว่ามี ข้อมูล Backup สำรองไว้แล้ว หรือ Copy Disk /opt ไว้ Data อยู่ในนั้น
Snapshots ต้องดู Disk Mode ใน VMware ด้วยว่าเป็น Dependent หรือ Independent persistent ถ้าเป็นตัวนี้จะไม่ถูก Snapshots ด้วย
2. Download zimbra software Version ที่ต้องการ แล้วเอาไฟล์ไปไว้ Server ตามที่ต้องการ ใช้ scp หรือ wget ก็ได้
https://www.zimbra.com/downloads/zimbra-collaboration-open-source/archives/
3. แตกไฟล์ ที่ Load มาได้
  1. tar -xvf zcs8.XXXXXX

4. ติดตั้ง dnsmasq
  1. apt-get install dnsmasq

แก้ config
  1. nano /etc/dnsmasq.conf

แก้ดังนี้
server=8.8.8.8
listen-address=127.0.0.1
domain=sci.com
mx-host=sci.com,zimbra.sci.com,0
address=/zimbra.sci.com/192.168.2.102
service dnsmasq restart

5. Test run
dig mx sci.com
dig zimbra.sci.com

6. สำคัญถ้าไม่ทำไม่ผ่าน
  1. nano /etc/apt/sources.list.d/zimbra.list
(เป็น http ถึงจะผ่าน ลบ s ออก)
สำหรับ ubuntu 16.04 ใช้เป็น xenial
8.8.7
deb [arch=amd64] http://repo.zimbra.com/apt/87 xenial zimbra
deb [arch=amd64] http://repo.zimbra.com/apt/zv1 xenial zimbra
deb-src [arch=amd64] http://repo.zimbra.com/apt/87 xenial zimbra


8.8.11
deb [arch=amd64] http://repo.zimbra.com/apt/87 xenial zimbra
deb [arch=amd64] http://repo.zimbra.com/apt/8811 xenial zimbra
deb-src [arch=amd64] http://repo.zimbra.com/apt/87 xenial zimbra


สำหรับ ubuntu 12.04, 14.04 ใช้เป็น trusty
8.8.11
deb [arch=amd64] http://repo.zimbra.com/apt/87 trusty zimbra
deb [arch=amd64] http://repo.zimbra.com/apt/8811 trusty zimbra
deb-src [arch=amd64] http://repo.zimbra.com/apt/87 trusty zimbra


เพิ่มเติม https://wiki.zimbra.com/wiki/Zimbra_Collaboration_repository

7. add key สำคัญ ต้องใช้ถ้าไม่ Run จะไม่ผ่าน ฟ้อง GPG key ไม่ผ่าน
  1. apt-key adv --keyserver keyserver.ubuntu.com --recv-keys 9BE6ED79

Importing Zimbra GPG key
ERROR: Unable to retrive Zimbra GPG key for package validation
Please fix system to allow normal package installation before proceeding

8. Test ว่าหา zimbra program เจอหรือไม่ ต้องมีค่าออกมาคือเจอ pack ที่ค้นหา
  1. apt-get install aptitude
  2. apt-get update
  3. aptitude search zimbra-nginx

9. เริ่ม Upgrad เข้าไปที่ Folder ที่แตกไว้ในข้อ 3.
  1. ./install.sh

Y (ยอมรับเงือนไข)
N (*** สำคัญไม่ต้องตอบ Y เพราะ ถ้าตอบ Y sources list จะถูกแก้เป็น HTTPS จะ ลงไม่ได้)
ถ้าตอบ Y จะเป็นแบบนี้
Use Zimbra's package repository [Y] y
Configuring package repository
ERROR: Unable to install packages via apt-get
Please fix system to allow normal package installation before proceeding
(ไม่ผ่าน)

https://forums.zimbra.org/viewtopic.php?t=66069
เลือกตอบ Y หรือ N ถ้าไม่ต้องการในโปรแกรมที่จะลงเพิ่ม เช่น zimbra-chate, zimbra-dive , zimbra-imapd(beta)
แล้วsave yes modifile รอจนกว่าจะเสร็จ
10. ทดลองเข้า
[url]้https://zimbra.sci.com[/url]

11. แก้ Redirect http to https 8.8.11
  1. su – zimbra
  2. zmprov ms `zmhostname` zimbraReverseProxyMailMode redirect
  3. zmcontrol restart
  4.  

https://blog.christosoft.de/2015/06/zimbra-redirect-http-to-https/

Step Restore INC **** ไม่สำเร็จ ******

Step Restore INC **** ไม่สำเร็จ ******
Restore Full เสร็จไปแล้วแต่อยากจะ Restore INC เพิ่มสักวัน
เช่น Restore full-20190518180020
inc-20190520211002
inc-20190521211002
ต้องการ inc วันที่ 22 เข้าไป

1.แตกไฟล์ inc
  1. tar -xvf Zimbra_Inc_20190522.tar.gz


ที่ต้องมี
- inc-20190522211002
- sessions.txt

2. ถ้า run คำสั่งเลยจะฟ้องว่ามีชื่ออยู่แล้ว
zmbkpose -restoreAccount suwit_j@sci.com,boonta_p@sci.com,seksan_k@sci.com
Account suwit_j@sci.com exists. Use zmbkpose -r suwit_j@sci.com SESSION_name.
Account boonta_p@sci.com exists. Use zmbkpose -r boonta_p@sci.com SESSION_name.
Account seksan_k@sci.com exists. Use zmbkpose -r seksan_k@sci.com SESSION_name.


zmbkpose -r suwit_j@sci.com,boonta_p@sci.com,seksan_k@sci.com
Not implemented.
Not implemented.
Not implemented.



สามารถใช้คำสั่ง zmbkpose -r email1,email2,email3..... ตามด้วยชื่อที่ได้จากคำสั่ง zmbkpose -l
เช่น
zimbra@zimbra:/TestRestore$ zmbkpose -l
full-20190518180020
inc-20190520211002
inc-20190521211002
inc-20190522211002
zimbra@zimbra:/TestRestore$ zmbkpose -r suwit_j@sci.com,boonta_p@sci.com,seksan_k@sci.com inc-20190522211002


หรือ จะใช้วิธีแก้ไฟล์ sessions.txt

ต้องทำการแก้ไฟล์ sessions.txt โดยลบ วัน full และวันที่ inc อื่นๆ ออก ให้เลือกเฉพาะ inc ของวันทีจะ Restore
โดย
nano sessions.txt
กด Ctrl + k (ลบทั้งแถว)
ให้เหลือไว้แค่ INC ของวันที่ที่จะ Restore เช่น วันที่ 20190522
SESSION: inc-20190522211002 started on Wed May 22 21:10:02 +07 2019
inc-20190522211002:admin@sci.com:05/22/19
inc-20190522211002:spam.9q7cb0mh8a@sci.com:05/22/19
inc-20190522211002:ham.whcctrpt@sci.com:05/22/19
inc-20190522211002:virus-quarantine.rl2yqjwk@sci.com:05/22/19
inc-20190522211002:galsync.zxqk9lahef@sci.com:05/22/19
inc-20190522211002:kamoltham_t@sci.com:05/22/19
inc-20190522211002:kittiya_s@sci.com:05/22/19
inc-20190522211002:jakkrit_h@sci.com:05/22/19
inc-20190522211002:jintana_y@sci.com:05/22/19
inc-20190522211002:jirayu_k@sci.com:05/22/19
inc-20190522211002:jureerat_w@sci.com:05/22/19
inc-20190522211002:charkrit_j@sci.com:05/22/19
inc-20190522211002:chamnarn_c@sci.com:05/22/19
inc-20190522211002:chumpol_l@sci.com:05/22/19


3. Run คำสั่ง จะเจอวันที่ที่เราจะ Restore วันเดียว
zmbkpose -l
inc-20190522211002


4. Run คำสั่ง Restore
  1. zmbkpose -r suwit_j@sci.com,boonta_p@sci.com,seksan_k@sci.com inc-20190522211002


******* zmbkpose -r มีปัญหา Restore ไม่ได้ Error ตามด้านล่าง ไม่มีข้อมูลเพิ่ม *************
ให้ใช้ Full และ Full+INC เอา

<html>
<head>
<meta http-equiv="Content-Type" content="text/html;charset=utf-8"/>
<title>Error 500 Server Error</title>
</head>
<body><h2>HTTP ERROR 500</h2>
<p>Problem accessing /service/home/suwit_j@sci.com/. Reason:
<pre> Server Error</pre></p>
</body>
</html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html;charset=utf-8"/>
<title>Error 500 Server Error</title>
</head>
<body><h2>HTTP ERROR 500</h2>
<p>Problem accessing /service/home/suwit_j@sci.com/Junk. Reason:
<pre> Server Error</pre></p>
</body>
</html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html;charset=utf-8"/>
<title>Error 500 Server Error</title>
</head>
<body><h2>HTTP ERROR 500</h2>
<p>Problem accessing /service/home/suwit_j@sci.com/Trash. Reason:
<pre> Server Error</pre></p>
</body>
</html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html;charset=utf-8"/>
<title>Error 500 Server Error</title>
</head>
<body><h2>HTTP ERROR 500</h2>
<p>Problem accessing /service/home/boonta_p@sci.com/Junk. Reason:
<pre> Server Error</pre></p>
</body>
</html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html;charset=utf-8"/>
<title>Error 500 Server Error</title>
</head>
<body><h2>HTTP ERROR 500</h2>
<p>Problem accessing /service/home/boonta_p@sci.com/Trash. Reason:
<pre> Server Error</pre></p>
</body>
</html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html;charset=utf-8"/>
<title>Error 500 Server Error</title>
</head>
<body><h2>HTTP ERROR 500</h2>
<p>Problem accessing /service/home/seksan_k@sci.com/Junk. Reason:
<pre> Server Error</pre></p>
</body>
</html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html;charset=utf-8"/>
<title>Error 500 Server Error</title>
</head>
<body><h2>HTTP ERROR 500</h2>
<p>Problem accessing /service/home/seksan_k@sci.com/Trash. Reason:
<pre> Server Error</pre></p>
</body>
</html>


แบบแก้ ไฟล์ sessions.txt

zimbra@zimbra:/TestRestore$ zmbkpose -l
inc-20190522211002
zimbra@zimbra:/TestRestore$ zmbkpose -r suwit_j@sci.com
Not implemented.
zimbra@zimbra:/TestRestore$ zmbkpose -r suwit_j@sci.com inc-20190522211002
<html>
<head>
<meta http-equiv="Content-Type" content="text/html;charset=utf-8"/>
<title>Error 500 Server Error</title>
</head>
<body><h2>HTTP ERROR 500</h2>
<p>Problem accessing /service/home/suwit_j@sci.com/. Reason:
<pre> Server Error</pre></p>
</body>
</html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html;charset=utf-8"/>
<title>Error 500 Server Error</title>
</head>
<body><h2>HTTP ERROR 500</h2>
<p>Problem accessing /service/home/suwit_j@sci.com/Junk. Reason:
<pre> Server Error</pre></p>
</body>
</html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html;charset=utf-8"/>
<title>Error 500 Server Error</title>
</head>
<body><h2>HTTP ERROR 500</h2>
<p>Problem accessing /service/home/suwit_j@sci.com/Trash. Reason:
<pre> Server Error</pre></p>
</body>
</html>

Step Restore By zmbkpose FULL + INC

Step Restore By zmbkpose FULL + INC
***สำคัญ ใช้ zmbkpose Version ไหนต้องใช้ Version นั้น Restore เพราะ Code ไม่เหมือนกัน***
**** ต้องเตรียมไฟล์ให้พร้อม จาก Full จนถึงวันที่จะ Restore INC
เช่น
zimbra@zimbra:/TestRestore$ ls -la
total 80
drwxr-xr-x 5 root root 4096 May 27 16:15 .
drwxr-xr-x 25 root root 4096 May 27 16:09 ..
drwxr-xr-x 2 root root 4096 May 27 16:14 full-20190518180020
drwxr-xr-x 2 root root 20480 May 27 16:14 inc-20190520211002
drwxr-xr-x 2 root root 28672 May 27 16:14 inc-20190521211002
-rwxr-xr-x 1 root root 17778 May 27 16:14 sessions.txt


แตกไฟล์ inc ของวันต่าง ๆ ที่ต้องการ Restore ไว้
  1. tar -xvf Zimbra_Inc_20190521.tar.gz


1. ข้อมูลต้องมี ตามไฟล์ เช่น Full 20190518
- inc-20190520211002
- inc-20190521211002
- sessions.txt (ของวันที่ล่าสุด จะมี full เริ่มต้นและ Inc ของวันอื่นได ด้วย)

2. เช็คด้วยคำสั่ง zmbkpose -l
zmbkpose -l
full-20190518180020
inc-20190520211002
inc-20190521211002


3. Run คำสั่ง zmbkpose -restoreAccount เพื่อ Restore Data
  1. zmbkpose -restoreAccount suwit_j@sci.com,boonta_p@sci.com,seksan_k@sci.com

โปรแกรมก็จะเริ่ม Restore จาก Full และ INC ที่มีอยู่ รอจนกว่าจะเสร็จ ช้าขึ้นอยู่กับปริมาณข้อมูล

zmbkpose -restoreAccount suwit_j@sci.com,boonta_p@sci.com,seksan_k@sci.com
Sessions found full-20190518180020
inc-20190520211002
inc-20190521211002
Restoring from full-20190518180020
adding new entry "uid=suwit_j,ou=people,dc=sci,dc=com"

<html>
<head>
<meta http-equiv="Content-Type" content="text/html;charset=utf-8"/>
<title>Error 500 Server Error</title>
</head>
<body><h2>HTTP ERROR 500</h2>
<p>Problem accessing /service/home/suwit_j@sci.com/Junk. Reason:
<pre> Server Error</pre></p>
</body>
</html>
suwit_j@sci.com restored from full-20190518180020
Restoring from inc-20190520211002
adding new entry "uid=suwit_j,ou=people,dc=sci,dc=com"

<html>
<head>
<meta http-equiv="Content-Type" content="text/html;charset=utf-8"/>
<title>Error 500 Server Error</title>
</head>
<body><h2>HTTP ERROR 500</h2>
<p>Problem accessing /service/home/suwit_j@sci.com/Junk. Reason:
<pre> Server Error</pre></p>
</body>
</html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html;charset=utf-8"/>
<title>Error 500 Server Error</title>
</head>
<body><h2>HTTP ERROR 500</h2>
<p>Problem accessing /service/home/suwit_j@sci.com/Trash. Reason:
<pre> Server Error</pre></p>
</body>
</html>
suwit_j@sci.com restored from inc-20190520211002
Restoring from inc-20190521211002
adding new entry "uid=suwit_j,ou=people,dc=sci,dc=com"

<html>
<head>
<meta http-equiv="Content-Type" content="text/html;charset=utf-8"/>
<title>Error 500 Server Error</title>
</head>
<body><h2>HTTP ERROR 500</h2>
<p>Problem accessing /service/home/suwit_j@sci.com/Junk. Reason:
<pre> Server Error</pre></p>
</body>
</html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html;charset=utf-8"/>
<title>Error 500 Server Error</title>
</head>
<body><h2>HTTP ERROR 500</h2>
<p>Problem accessing /service/home/suwit_j@sci.com/Trash. Reason:
<pre> Server Error</pre></p>
</body>
</html>
suwit_j@sci.com restored from inc-20190521211002
Sessions found full-20190518180020
inc-20190520211002
inc-20190521211002
Restoring from full-20190518180020
adding new entry "uid=boonta_p,ou=people,dc=sci,dc=com"

<html>
<head>
<meta http-equiv="Content-Type" content="text/html;charset=utf-8"/>
<title>Error 500 Server Error</title>
</head>
<body><h2>HTTP ERROR 500</h2>
<p>Problem accessing /service/home/boonta_p@sci.com/Junk. Reason:
<pre> Server Error</pre></p>
</body>
</html>
boonta_p@sci.com restored from full-20190518180020
Restoring from inc-20190520211002
adding new entry "uid=boonta_p,ou=people,dc=sci,dc=com"

<html>
<head>
<meta http-equiv="Content-Type" content="text/html;charset=utf-8"/>
<title>Error 500 Server Error</title>
</head>
<body><h2>HTTP ERROR 500</h2>
<p>Problem accessing /service/home/boonta_p@sci.com/Junk. Reason:
<pre> Server Error</pre></p>
</body>
</html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html;charset=utf-8"/>
<title>Error 500 Server Error</title>
</head>
<body><h2>HTTP ERROR 500</h2>
<p>Problem accessing /service/home/boonta_p@sci.com/Trash. Reason:
<pre> Server Error</pre></p>
</body>
</html>
boonta_p@sci.com restored from inc-20190520211002
Restoring from inc-20190521211002
adding new entry "uid=boonta_p,ou=people,dc=sci,dc=com"

<html>
<head>
<meta http-equiv="Content-Type" content="text/html;charset=utf-8"/>
<title>Error 500 Server Error</title>
</head>
<body><h2>HTTP ERROR 500</h2>
<p>Problem accessing /service/home/boonta_p@sci.com/Junk. Reason:
<pre> Server Error</pre></p>
</body>
</html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html;charset=utf-8"/>
<title>Error 500 Server Error</title>
</head>
<body><h2>HTTP ERROR 500</h2>
<p>Problem accessing /service/home/boonta_p@sci.com/Trash. Reason:
<pre> Server Error</pre></p>
</body>
</html>
boonta_p@sci.com restored from inc-20190521211002
Sessions found full-20190518180020
inc-20190521211002
Restoring from full-20190518180020
adding new entry "uid=seksan_k,ou=people,dc=sci,dc=com"

<html>
<head>
<meta http-equiv="Content-Type" content="text/html;charset=utf-8"/>
<title>Error 500 Server Error</title>
</head>
<body><h2>HTTP ERROR 500</h2>
<p>Problem accessing /service/home/seksan_k@sci.com/Junk. Reason:
<pre> Server Error</pre></p>
</body>
</html>
seksan_k@sci.com restored from full-20190518180020
Restoring from inc-20190521211002
adding new entry "uid=seksan_k,ou=people,dc=sci,dc=com"

<html>
<head>
<meta http-equiv="Content-Type" content="text/html;charset=utf-8"/>
<title>Error 500 Server Error</title>
</head>
<body><h2>HTTP ERROR 500</h2>
<p>Problem accessing /service/home/seksan_k@sci.com/Junk. Reason:
<pre> Server Error</pre></p>
</body>
</html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html;charset=utf-8"/>
<title>Error 500 Server Error</title>
</head>
<body><h2>HTTP ERROR 500</h2>
<p>Problem accessing /service/home/seksan_k@sci.com/Trash. Reason:
<pre> Server Error</pre></p>
</body>
</html>
seksan_k@sci.com restored from inc-20190521211002

ก็จะมี User และ Email ตามที่เรา Restore


Step Restore By zmbkpose FULL

Step Restore By zmbkpose FULL
***สำคัญ ใช้ zmbkpose Version ไหนต้องใช้ Version นั้น Restore เพราะ Code ไม่เหมือนกัน***
Mount จากไฟล์ ที่ Backup ไว้ได้เลย
  1. sudo mount -t cifs -o username=*******,password=******* //192.168.0.218/backup /DATA


1. ที่เราต้องมีคือ
- full-20190518180020 ข้อมูล Backup Full
- sessions.txt

2. นำ Foder Full และ ไฟล์ session.txt ไปไว้ ที่ Folder ที่ Config ไว้
  1. nano /etc/zmbkpose/zmbkpose.conf

ตรง WORKDIR=
ของจริงเอาไว้ใน WORKDIR=/DATA/zimbra_backup

3. Run คำสั่ง จะได้ ชื่อ Folder Full มา
เข้าเป็น
su zimbra
ก่อน Run
  1. zmbkpose -l


4. เริ่ม Restore ด้วยคำสั่ง
  1. zmbkpose -restoreAccount suwit_j@sci.com,boonta_p@sci.com,seksan_k@sci.com,.........(mail ของ user)

รอจนกว่าจะเสร็จครบทุก User อยู่ที่ข้อมูล ตัวอย่างลอง 3 USER
Sessions found full-20190518180020
Restoring from full-20190518180020
adding new entry "uid=suwit_j,ou=people,dc=sci,dc=com"

<html>
<head>
<meta http-equiv="Content-Type" content="text/html;charset=utf-8"/>
<title>Error 500 Server Error</title>
</head>
<body><h2>HTTP ERROR 500</h2>
<p>Problem accessing /service/home/suwit_j@sci.com/Junk. Reason:
<pre> Server Error</pre></p>
</body>
</html>
suwit_j@sci.com restored from full-20190518180020
Sessions found full-20190518180020
Restoring from full-20190518180020
adding new entry "uid=boonta_p,ou=people,dc=sci,dc=com"

<html>
<head>
<meta http-equiv="Content-Type" content="text/html;charset=utf-8"/>
<title>Error 500 Server Error</title>
</head>
<body><h2>HTTP ERROR 500</h2>
<p>Problem accessing /service/home/boonta_p@sci.com/Junk. Reason:
<pre> Server Error</pre></p>
</body>
</html>
boonta_p@sci.com restored from full-20190518180020
Sessions found full-20190518180020
Restoring from full-20190518180020
adding new entry "uid=seksan_k,ou=people,dc=sci,dc=com"

<html>
<head>
<meta http-equiv="Content-Type" content="text/html;charset=utf-8"/>
<title>Error 500 Server Error</title>
</head>
<body><h2>HTTP ERROR 500</h2>
<p>Problem accessing /service/home/seksan_k@sci.com/Junk. Reason:
<pre> Server Error</pre></p>
</body>
</html>
seksan_k@sci.com restored from full-20190518180020


5. ทดลองที่ Member จะเห็น User เพิ่มขึ้นมา และ View Mail ดูจะมีเมล์วันที่ Restore มา


ชื่อเมล์เอาได้จากไฟล์ sessions.txt มาแบ่งแล้ว : แล้วใส่ Comma คันเพื่อไป Run ต่อในคำสั่ง zmbkpose -restoreAccount ได้เลย

Zimbra 8.8.11 install on Ubuntu 16.04

Zimbra 8.8.11 install on Ubuntu 16.04
1. ติดตั้ง Ubuntu 16.04 Set network , apt, ntp, update , upgrade ให้เรียบร้อย
2. Add Disk เข้า Ubuntu ตามข้อ 1. mount /opt
3. แก้ fstab
/dev/sdb1 /opt ext4 defaults 0 0

4. Download zimbra software Version ที่ต้องการ แล้วเอาไฟล์ไปไว้ Server ข้อ 1. ใช้ scp หรือ wget ก็ได้
https://www.zimbra.com/downloads/zimbra-collaboration-open-source/archives/
5. แตกไฟล์ ที่ Load มาได้
  1. tar -xvf zcs8.XXXXXX

6. ติดตั้ง Program ที่ต้องใช้
  1. apt-get update -y
  2. apt-get install -y software-properties-common
  3. apt-get install -y language-pack-en-base
  4. export LC_ALL=en_US.UTF-8 && export LANG=en_US.UTF-8
  5. apt-get update -y && apt-get install -y iputils-ping

7. แก้ hosts และ resolv.conf
  1. nano /etc/hosts
192.168.2.114 zimbra.sci.com zimbra

  1. nano /etc/resolv.conf
nameserver 8.8.8.8

8. ติดตั้ง dnsmasq
  1. apt-get install dnsmasq

แก้ config
  1. nano /etc/dnsmasq.conf

แก้ดังนี้
server=8.8.8.8
listen-address=127.0.0.1
domain=sci.com
mx-host=sci.com,zimbra.sci.com,0
address=/zimbra.sci.com/192.168.2.114
service dnsmasq restart

9. Test run
dig mx sci.com
dig zimbra.sci.com

10. สำคัญถ้าไม่ทำไม่ผ่าน
  1. nano /etc/apt/sources.list.d/zimbra.list
(เป็น http ถึงจะผ่าน ลบ s ออก)
สำหรับ ubuntu 16.04 ใช้เป็น xenial
8.8.7
deb [arch=amd64] http://repo.zimbra.com/apt/87 xenial zimbra
deb [arch=amd64] http://repo.zimbra.com/apt/zv1 xenial zimbra
deb-src [arch=amd64] http://repo.zimbra.com/apt/87 xenial zimbra


8.8.11
deb [arch=amd64] http://repo.zimbra.com/apt/87 xenial zimbra
deb [arch=amd64] http://repo.zimbra.com/apt/8811 xenial zimbra
deb-src [arch=amd64] http://repo.zimbra.com/apt/87 xenial zimbra


สำหรับ ubuntu 12.04, 14.04 ใช้เป็น trusty
8.8.11
deb [arch=amd64] http://repo.zimbra.com/apt/87 trusty zimbra
deb [arch=amd64] http://repo.zimbra.com/apt/8811 trusty zimbra
deb-src [arch=amd64] http://repo.zimbra.com/apt/87 trusty zimbra


เพิ่มเติม https://wiki.zimbra.com/wiki/Zimbra_Collaboration_repository

11. add key สำคัญ ต้องใช้ถ้าไม่ Run จะไม่ผ่าน ฟ้อง GPG key ไม่ผ่าน
  1. apt-key adv --keyserver keyserver.ubuntu.com --recv-keys 9BE6ED79
  2.  

Error :
Importing Zimbra GPG key
ERROR: Unable to retrive Zimbra GPG key for package validation
Please fix system to allow normal package installation before proceeding

12. Test ว่าหา zimbra program เจอหรือไม่ ต้องมีค่าออกมาคือเจอ pack ที่ค้นหา
  1. apt-get install aptitude
  2. apt-get update
  3. aptitude search zimbra-nginx

13. เริ่มติดตั้ง เข้าไปที่ Folder ที่แตกไว้ในข้อ 5.
  1. ./install.sh

Y (ยอมรับเงือนไข)
N (*** สำคัญไม่ต้องตอบ Y เพราะ ถ้าตอบ Y sources list จะถูกแก้เป็น HTTPS จะ ลงไม่ได้)
Use Zimbra's package repository [Y] y
Configuring package repository
ERROR: Unable to install packages via apt-get
Please fix system to allow normal package installation before proceeding
(ไม่ผ่าน)

https://forums.zimbra.org/viewtopic.php?t=66069

Y ตาม Default หรือเลือกเอาว่าจะลงอะไรบ้าง รอ จนกว่าจะเสร็จ
No ตอนจะเปลี่ยน DNS และ Domain Name เพราะ Set ไว้ตั้งแต่ลง Ubuntu แล้ว
7 ---> 4 เปลี่ยนรหัส admin ตั้งตามที่ต้องการ แต่ห้ามซ้ำกับรหัส user root ทีใช้
r
5 เปลี่ยน DNS 192.168.0.253
แล้วsave yes modifile รอจนกว่าจะเสร็จ
14. ทดลองเข้า
https://192.168.2.114/7071

ข้อมูลเพิ่มเติม
https://blog.zimbra.com/2018/01/install-zimbra-collaboration-8-8-ubuntu-16-04-lts/https://blog.christosoft.de/2015/06/zimbra-redirect-http-to-https/

เข้าได้ใช้งานได้ Restore Data จาก Full backup
****ใช้ zmbkpose ต้องสร้างชื่อไว้ก่อนแล้วค่อยเอาเข้า****
https://intranet.sci.com/blog.php?u=3&b=389
https://intranet.sci.com/blog.php?u=3&b=390
ติดตั้ง Program อื่น ๆ เพิ่มเติม
https://intranet.sci.com/blog.php?u=281&b=627

Axapta : Update Costing PD ไม่ผ่านมี Error ฟ้อง

Axapta : Update Costing PD ไม่ผ่านมี Error ฟ้อง

Account number transaction type "" does not exist.

- เกิดจากการสร้าง Route --> Cost categeries ใหม่ แต่ไม่ได้ใส่ Account - WIP และ Account - Costing ที่เป็นตัวเลข 9000001 , 9000002
- แก้โดยไป Filter หาค่าว่างที่ช่อง นั้น แล้วใส่ ค่าเหมือนตัวอื่น 9000001 , 9000002
จากนั้นทดลอง Update Cost ใหม่จะผ่าน
เช่น 4533-5 xxxxx PMC16-6 ที่พึ่งเพิ่มเข้าไปใหม่