ข้ามไปที่เนื้อหาหลัก

วิธีตั้ง crontab ใน Ubuntu

หามาตั้งนาน วิธีตั้ง crontab ให้ sync เวลาจาก Time Server
มาให้กับ web apps server ต้องขอขอบคุณคุณผดุงศิลป์ JI

$ sudo nano /etc/crontab


# /etc/crontab: system-wide crontab
# Unlike any other crontab you don't have to run the `crontab'
# command to install the new version when you edit this file
# and files in /etc/cron.d. These files also have username fields,
# that none of the other crontabs do.


SHELL=/bin/sh
PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin


# m h dom mon dow user  command
1 * * * * root ntpdate 192.168.xx.xx //เพิ่มใหม่เข้ามา IP เป็นของ Time Server นะครับ
17 *    * * *   root    cd / && run-parts --report /etc/cron.hourly
25 6    * * *   root    test -x /usr/sbin/anacron || ( cd / && run-parts --report /etc/cron.daily )
47 6    * * 7   root    test -x /usr/sbin/anacron || ( cd / && run-parts --report /etc/cron.weekly )
52 6    1 * *   root    test -x /usr/sbin/anacron || ( cd / && run-parts --report /etc/cron.monthly )
#

Save แล้ว ออก
Ctrl+X ตอบ Y

ดู log
$ sudo tail -f /var/log/syslog
ตัวอย่าง
$ sudo tail -f /var/log/syslog
Jan 12 18:01:01 VLWeb CRON[8998]: (CRON) error (grandchild #9000 failed with exit status 127)
Jan 12 18:01:01 VLWeb CRON[8998]: (CRON) info (No MTA installed, discarding output)
Jan 12 18:05:01 VLWeb CRON[9004]: (root) CMD (ntpdate 192.168.10.12)
Jan 12 18:05:01 VLWeb CRON[9002]: (CRON) error (grandchild #9004 failed with exit status 127)
Jan 12 18:05:01 VLWeb CRON[9002]: (CRON) info (No MTA installed, discarding output)
Jan 12 18:09:01 VLWeb CRON[9007]: (root) CMD (  [ -x /usr/lib/php5/maxlifetime ] && [ -d /var/lib/php5 ] && find /var/lib/php5/ -type f -cmin +$(/usr/lib/php5/maxlifetime) -print0 | xargs -n 200 -r -0 rm)
Jan 12 18:09:01 VLWeb CRON[9005]: (CRON) info (No MTA installed, discarding output)
Jan 12 18:17:01 VLWeb CRON[9015]: (root) CMD (   cd / && run-parts --report /etc/cron.hourly)
Jan 12 18:25:01 VLWeb cron[757]: (*system*) RELOAD (/etc/crontab)
Jan 12 18:27:01 VLWeb cron[757]: (*system*) RELOAD (/etc/crontab)





ความคิดเห็น

โพสต์ยอดนิยมจากบล็อกนี้

วิธีแก้ปัญหา putty เป็นภาษาต่างดาวหรือเครื่องหมาย ???

ทำงานบน OS: CentOS-7-x86_64-Minimal-1511 ทดสอบบนแพกเกจ vsftpd แก้ไขไฟล์ .bashrc # vim .bashrc กดปุ่ม Insert เพื่อแก้ไข เลื่อนเคอเซอร์ลงบรรทัดล่างสุด พิมพ์ export LANG=th_TH ลงไปบรรทัดล่าง แล้วเซฟออกมา :wq! ------------------------------------------------------------ # .bashrc # User specific aliases and functions alias rm =' rm -i' alias cp =' cp -i' alias mv =' mv -i' # Source global definitions if [ -f /etc/bashrc ] ; then         . /etc/bashrc fi export LANG= th_TH ------------------------------------------------------------ แล้วไปกำหนดที่ putty ที่ Settings... ตรง Appearance เป็นฟอนต์ Fixedsys, 10-point ตรง Translation เป็น Use font encoding เสร็จแล้ว Save > Apply ออกมา การแสดงผลฝั่ง putty การแสดงผลฝั่ง FileZilla การแสดงผลฝั่ง WinSCP แต่ยังแก้ปัญหาใน บราวเซอร์และ windows ไม่ได้ ...หาต่อไป ถ้าได้จะมาบันทึกไว้ครับ

แก้ปัญหา Directory Index เป็นภาษาต่างดาว

เวลาเรียกดูไดเรคทอรี่งานที่เราเก็บไว้ ตามลิงค์ที่เราทำ แล้วมันเป็นภาษาต่างดาว เราจะแก้ไขดังนี้ เข้าไปแก้ไขไฟล์ httpd.conf # vim /etc/httpd/conf/httpd.conf # First, we configure the "default" to be a very restrictive set of # features. # <Directory   / >     Options FollowSymLinks     AllowOverride None # # Note that from this point forward you must specifically allow # particular features to be enabled - so if something's not working as # you might expect, make sure that you have specifically enabled it # below. # # # This should be changed to whatever you set DocumentRoot to. # <Directory   "/var/www/html" > # # Possible values for the Options directive are "None", "All", # or any combination of: #   Indexes Includes FollowSymLinks SymLinksifOwnerMatch ExecCGI MultiViews # # Note that "MultiViews" must be named *explicitly* --- "Options All" # doesn't give it to you. # ...

ประวัติต้นแดง

ชื่อพื้นเมือง ต้นแดง เป็นพืชจำพวกต้น ชื่อวิทยาศาสตร์ Xylia xylocarpa (Roxb.) Taub. var. kerrii (Craib & Hutch) I.C. Nielsen ชื่อวงศ์ Leguminosae – Mimosoideae ชื่อทางการค้า Iron wood, Jamba, Pyinkdo, Irul ชื่อพื้นเมือง สะกรอม ตะกร้อม กร้อม ชื่ออื่นๆ จาลาน (แม่ฮ่องสอน), สะกรอม (เขมร), ปราน, ไปรน์ (ส่วย), เพ้ย (ตาก), กร้วม (โคราช), คว้าย (กะเหรี่ยง), พ้าน (ละว้า), ตะกร้อม (จันทบุรี) ลักษณะทั่วไป เป็นไม้ยืนต้นขนาดกลางถึงขนาดใหญ่ ผลัดใบสูง 15-25 เมตร ลำต้นค่อนข้างเปลาตรงหรือเป็นปุ่มปม ในสภาพที่ดินตื้นไม่เหมาะสมกับการเจริญเติบโต ลำต้นจะเล็กและคดงอ จะแตกกิ่งต่ำมีพุ่มใบมาก เปลือกสีเทาอมแดง ตกสะเก็ดออกเป็นแผ่นบางๆ รอบลำต้น เปลือกในสีน้ำตาลแดง เมื่อสับเปลือกทิ้งไว้จะได้ชันสีแดง รูปทรง (เรือนยอด) เรือนยอดเป็นพุ่มกว้างไม่ค่อยเป็นระเบียบ ใบ เป็นช่อแบบขนนกสองชั้น ติดเรียงสลับยาว 10-30 ซม. ช่อหนึ่งๆ มีช่อแขนงที่ออกจากปลายก้านช่อใหญ่ สองช่อ ระหว่างง่ามช่อแขนงจะมีตุ่ม สีน้ำตาลแดงหรือสีชมพูปรากฎอยู่ ดอก มีขนาดเล็ก ออกรวมกับเป็นช่อที่ไม่แยกแขนง รูปทรงกลมคล้ายดอกกระถินกลีบดอกมี 5 กล...