Admin:Bin

From P&T Knowledgebase
Revision as of 17:12, 4 October 2010 by Admin (talk | contribs) (→‎SQL)
Jump to navigation Jump to search

คำสั่ง start httpd ขั้นเทพ

* ในกรณีที่ start httpd ไม่ขึ้น

/usr/bin/ipcrm sem $(/usr/bin/ipcs -s | grep apache | awk '{print$2}')
/etc/init.d/httpd restart

MySQL Dump

mysqldump --user {username} --password={password} {dbname} > filename.sql
mysql --user {username} --password={password} {dbname} < filename.sql

URL

CMS

Wordpress

ตั้งโดเมนที่ใช้กับ Wordpress

เวลาเปลี่ยนโดเมนที่ใช้กับ Wordpress จะทำให้เข้า WP-ADMIN ไม่ได้ ทำให้เข้าไปตั้ง Site URL หรือ Blog URL เนี่ยแหละ เข้าไปตั้งไม่ได้ วิธีการแก้ไข คือ ให้ไป define constant เพิ่มใน wp-config.php ดังนี้

define("WP_HOME","http://www.example.com");
define("WP_SITEURL","http://www.example.com");

Joomla

Check Version Joomla

grep var libraries/joomla/version.php

SQL

แสดง IP Class C ที่เรามี

SELECT SUBSTRING_INDEX(`host_ip`, '.', 3)
FROM `lnw_lnwhost__hosts` 
LEFT JOIN `lnw_lnwhost__host_resellers` USING (`host_reseller_id`)
WHERE `host_ip` IS NOT NULL
GROUP BY SUBSTRING_INDEX(`host_ip`, '.', 3)

หา IP Class C ที่ยังไม่ได้ใช้ (สำหรับโฮสติ้ง)

เวลาเอาไปใช้ เปลี่ยนตรง WHERE `user_id`=...

SELECT 
`host_reseller_id`, SUBSTRING_INDEX(`host_ip`, '.', 3) , `host_ip` 
FROM `lnw_lnwhost__host_resellers`
WHERE 
`username`='pathosting' AND
SUBSTRING_INDEX(`host_ip`, '.', 3) NOT IN (
SELECT 
SUBSTRING_INDEX(`host_ip`, '.', 3)
FROM `lnw_lnwhost__hosts` 
LEFT JOIN `lnw_lnwhost__host_resellers` USING (`host_reseller_id`)
WHERE `user_id`=37111
GROUP BY SUBSTRING_INDEX(`host_ip`, '.', 3)
)

เวลาเอาใส่ order.extra

{"REQHRESELLID":1}

หา IP Class C ที่ยังไม่ได้ใช้ (แปลกๆ)

SELECT * FROM `lnw_lnwhost__host_servers_ips` 
WHERE 
`parent_ip` NOT LIKE  AND
substring(`ip`,1,9) NOT IN (
'61.19.247',
'61.19.250',
'61.19.246',
'122.155.5',
'122.155.5',
'122.155.5',
'61.19.246',
'61.19.250',
'61.19.247',
'61.19.247',
'61.19.246',
'61.19.250',
'122.155.5') 
AND 
`ns1` LIKE 'NS%.PATHOSTING.COM'
GROUP BY substring(`ip`,1,9)

DirectAdmin

Manual edit User/Reseller

  • แก้ที่ไฟล์ /usr/local/directadmin/data/users/reseller/users.list
    • ลบออกจาก reseller เดิม
    • เพิ่มที่ reseller ใหม่
  • แก้ไฟล์ /usr/local/directadmin/data/users/username/user.conf , แก้บรรทัด creator=
  • รันคำสั่ง
    echo "action=cache&value=showallusers" >> /usr/local/directadmin/data/task.queue