{"id":310,"date":"2015-09-11T12:39:58","date_gmt":"2015-09-11T12:39:58","guid":{"rendered":"http:\/\/onlinelab.info\/?p=310"},"modified":"2015-09-11T12:39:58","modified_gmt":"2015-09-11T12:39:58","slug":"linux-server-see-the-historical-and-statistical-uptime-of-system-with-tuptime-utility","status":"publish","type":"post","link":"https:\/\/www.asianux.org.vn\/index.php\/2015\/09\/11\/linux-server-see-the-historical-and-statistical-uptime-of-system-with-tuptime-utility\/","title":{"rendered":"Linux Server See the Historical and Statistical Uptime of System With tuptime Utility"},"content":{"rendered":"<p>B\u1ea1n c\u00f3 th\u1ec3 d\u00f9ng c\u00e1c c\u00f4ng c\u1ee5 sau tr\u00ean Linux \u0111\u1ec3 ki\u1ec3m tra c\u00e1c th\u00f4ng tin v\u1ec1 h\u1ec7 th\u1ed1ng c\u1ee7a m\u00ecnh. C\u1ee5 th\u1ec3 c\u00e1c c\u00e2u l\u1ec7nh:<\/p>\n<ul>\n<li>uptime: Cho ta bi\u1ebft h\u1ec7 th\u1ed1ng \u0111\u00e3 ch\u1ea1y \u0111\u01b0\u1ee3c bao nhi\u00eau l\u00e2u.<\/li>\n<li>last: hi\u1ec3n th\u1ecb th\u1eddi gian kh\u1edfi \u0111\u1ed9ng l\u1ea1i v\u00e0 t\u1eaft m\u00e1y t\u00ednh.<\/li>\n<li>tuptime: C\u00e2u l\u1ec7nh nh\u01b0 uptime nh\u01b0ng cho k\u1ebft qu\u1ea3 r\u00f5 r\u00e0ng h\u01a1n.<\/li>\n<\/ul>\n<p>C\u00e1c b\u1ea1n tham kh\u1ea3o h\u00ecnh d\u01b0\u1edbi \u0111\u00e2y:<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone\" src=\"http:\/\/i.imgur.com\/n9lFL8Z.jpg\" alt=\"\" width=\"717\" height=\"416\" title=\"\"><\/p>\n<p>C\u00f4ng c\u1ee5 tuptime<\/p>\n<h3><\/h3>\n<p>\u0110\u1ec3 c\u00e0i \u0111\u1eb7t, b\u1ea1n c\u00f3 th\u1ec3 d\u00f9ng c\u00e1c l\u1ec7nh sau ho\u1eb7c l\u00e0m nh\u01b0 h\u00ecnh d\u01b0\u1edbi<br \/>\n<code>$ cd \/tmp<br \/>\n$ git clone https:\/\/github.com\/rfrail3\/tuptime.git<br \/>\n$ ls<br \/>\n$ cd tuptime<br \/>\n$ ls<\/code><\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone\" src=\"http:\/\/i.imgur.com\/NV6SO2J.jpg\" alt=\"\" width=\"715\" height=\"325\" title=\"\"><\/p>\n<p>B\u1ea1n h\u00e3y ch\u1eafc ch\u1eafn Python \u0111\u00e3 \u0111\u01b0\u1ee3c c\u00e0i \u0111\u1eb7t \u0111\u1ec3 ch\u1ea1y c\u00e1c th\u01b0 vi\u1ec7n:<\/p>\n<p><code>$ sudo tuptime-install.sh<\/code><\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone\" src=\"http:\/\/i.imgur.com\/seQMalk.jpg\" alt=\"\" width=\"733\" height=\"692\" title=\"\"><\/p>\n<p>Ho\u1eb7c b\u1ea1n c\u00f3 th\u1ec3 ch\u1ea1y c\u00e1c l\u1ec7nh b\u1eb1ng tay:<br \/>\n$ sudo cp \/tmp\/tuptime\/latest\/cron.d\/tuptime \/etc\/cron.d\/tuptime<br \/>\nSao ch\u00e9p d\u1ecbch v\u1ee5 m\u1eb7c \u0111\u1ecbnh v\u00e0 cho ch\u00fang kh\u1edfi \u0111\u1ed9ng.<br \/>\n<code>$ sudo cp \/tmp\/tuptime\/latest\/systemd\/tuptime.service \/lib\/systemd\/system\/<br \/>\n$ sudo systemctl enable tuptime.service<\/code><\/p>\n<p><code>$ sudo cp \/tmp\/tuptime\/latest\/init.d\/tuptime.init.d-debian7 \/etc\/init.d\/tuptime<br \/>\n$ sudo update-rc.d tuptime defaults<\/code><\/p>\n<h3>Ch\u1ea1y:<\/h3>\n<p>B\u1ea1n c\u00f3 th\u1ec3 d\u00f9ng c\u00e1ch ch\u1ea1y \u0111\u01a1n gi\u1ea3n sau:<br \/>\n<code>$ sudo tuptime<\/code><br \/>\nK\u1ebft qu\u1ea3 s\u1ebd l\u00e0<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"size-full wp-image-577\" src=\"http:\/\/s0.cyberciti.org\/uploads\/cms\/2015\/09\/tuptime-output.jpg\" alt=\"Fig.03: tuptime in action\" width=\"598\" height=\"163\" title=\"\"><\/p>\n<pre>$ <strong>sudo tuptime<\/strong>\n<kbd>System startups:\t2   since   03:52:16 PM 08\/21\/2015\nSystem shutdowns:\t1 ok   -   0 bad\nAverage uptime: \t7 days, 16 hours, 48 minutes and 3 seconds\nAverage downtime: \t2 hours, 30 minutes and 5 seconds\nCurrent uptime: \t5 minutes and 28 seconds   since   06:23:06 AM 09\/06\/2015\nUptime rate: \t\t98.66 %\nDowntime rate: \t\t1.34 %\nSystem uptime: \t\t15 days, 9 hours, 36 minutes and 7 seconds\nSystem downtime: \t5 hours, 0 minutes and 11 seconds\nSystem life: \t\t15 days, 14 hours, 36 minutes and 18 seconds<\/kbd><\/pre>\n<p>B\u1ea1n c\u00f3 th\u1ec3 \u0111\u01b0a \u0111\u1ecbnh d\u1ea1ng v\u1ec1 ng\u00e0y th\u00e1ng n\u0103m<br \/>\n<code>$ sudo tuptime -d '%H:%M:%S %m-%d-%Y'<\/code><\/p>\n<pre>System startups:\t1   since   15:52:16 08-21-2015\nSystem shutdowns:\t0 ok   -   0 bad\nAverage uptime: \t15 days, 9 hours, 21 minutes and 19 seconds\nAverage downtime: \t0 seconds\nCurrent uptime: \t15 days, 9 hours, 21 minutes and 19 seconds   since   15:52:16 08-21-2015\nUptime rate: \t\t100.0 %\nDowntime rate: \t\t0.0 %\nSystem uptime: \t\t15 days, 9 hours, 21 minutes and 19 seconds\nSystem downtime: \t0 seconds\nSystem life: \t\t15 days, 9 hours, 21 minutes and 19 seconds<\/pre>\n<p><code>$ sudo tuptime -e<\/code><br \/>\nK\u1ebft qu\u1ea3:<\/p>\n<pre class=\"ini\">Startup:  1  at  03:52:16 PM 08\/21\/2015\nUptime:   15 days, 9 hours, 22 minutes and 33 seconds\n\u00a0\nSystem startups:\t1   since   03:52:16 PM 08\/21\/2015\nSystem shutdowns:\t0 ok   -   0 bad\nAverage uptime: \t15 days, 9 hours, 22 minutes and 33 seconds\nAverage downtime: \t0 seconds\nCurrent uptime: \t15 days, 9 hours, 22 minutes and 33 seconds   since   03:52:16 PM 08\/21\/2015\nUptime rate: \t\t100.0 %\nDowntime rate: \t\t0.0 %\nSystem uptime: \t\t15 days, 9 hours, 22 minutes and 33 seconds\nSystem downtime: \t0 seconds\nSystem life: \t\t15 days, 9 hours, 22 minutes and 33 seconds<\/pre>\n<p>Ch\u00fac c\u00e1c b\u1ea1n th\u00e0nh c\u00f4ng !<\/p>\n","protected":false},"excerpt":{"rendered":"<p>B\u1ea1n c\u00f3 th\u1ec3 d\u00f9ng c\u00e1c c\u00f4ng c\u1ee5 sau tr\u00ean Linux \u0111\u1ec3 ki\u1ec3m tra c\u00e1c th\u00f4ng tin v\u1ec1 h\u1ec7 th\u1ed1ng c\u1ee7a m\u00ecnh. C\u1ee5 th\u1ec3 c\u00e1c c\u00e2u l\u1ec7nh: uptime: Cho ta bi\u1ebft h\u1ec7 th\u1ed1ng \u0111\u00e3 ch\u1ea1y \u0111\u01b0\u1ee3c&hellip;<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[3],"tags":[],"class_list":["post-310","post","type-post","status-publish","format-standard","hentry","category-linux"],"_links":{"self":[{"href":"https:\/\/www.asianux.org.vn\/index.php\/wp-json\/wp\/v2\/posts\/310","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.asianux.org.vn\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.asianux.org.vn\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.asianux.org.vn\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.asianux.org.vn\/index.php\/wp-json\/wp\/v2\/comments?post=310"}],"version-history":[{"count":0,"href":"https:\/\/www.asianux.org.vn\/index.php\/wp-json\/wp\/v2\/posts\/310\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.asianux.org.vn\/index.php\/wp-json\/wp\/v2\/media?parent=310"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.asianux.org.vn\/index.php\/wp-json\/wp\/v2\/categories?post=310"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.asianux.org.vn\/index.php\/wp-json\/wp\/v2\/tags?post=310"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}