crontab checker

Posted by nopsled
2018.04.26 18:13 운영체제

직장에서 crontab을 이렇게 열심히 쓸줄은 몰랐다.


심심해서 crontab checker 만들려고 했는데 누가 만들어놨다... 그것도 온라인으로.....


https://crontab.guru/

위 링크에서 cron command 만들고 


http://cron.schlitt.info/


위에서 테스트하면 확실하게 알 수 있다.

'운영체제' 카테고리의 다른 글

/etc/sudoers 권한 변경 실패시  (0) 2018.12.10
linux UTC to KST (also hardware time too)  (0) 2018.06.05
crontab checker  (0) 2018.04.26
ssh process continue after logout  (0) 2018.04.19
Mac high sierra apache connection refused error  (0) 2018.01.08
ssh process continuation  (0) 2015.10.10
이 댓글을 비밀 댓글로

18.02.22 전역

Posted by nopsled
2018.04.25 00:55 일상생활

​​



오래전에 했지만 지금 올린다. 고마운 녀석들😊 고생많았다

'일상생활' 카테고리의 다른 글

중년기사김봉식 매크로  (9) 2018.08.09
18.02.22 전역  (0) 2018.04.25
페이스북 video_xxxx.zip  (0) 2017.12.17
2017.09.12  (0) 2017.09.12
2017.06.10  (0) 2017.06.10
육군 정보보호병  (5) 2016.04.23
이 댓글을 비밀 댓글로

[javascript] calculate datetime

Posted by nopsled
2018.04.24 17:39 프로그래밍

Calculate datetime 2 ways.



1 way will be calculate about YYYY-MM - YYYY-MM


function calMonthRange(val1, val2)
{
var FORMAT = "-";
if (val1.length != 7 || val2.length != 7)
return null;
if (val1.indexOf(FORMAT) < 0 || val2.indexOf(FORMAT) < 0)
return null;
var start_dt = val1.split(FORMAT);
var end_dt = val2.split(FORMAT);
start_dt[1] = (Number(start_dt[1]) - 1) + "";
end_dt[1] = (Number(end_dt[1]) - 1) + "";
var from_dt = new Date(start_dt[0], start_dt[1]);
var to_dt = new Date(end_dt[0], end_dt[1]);
return Math.ceil((to_dt.getTime() - from_dt.getTime()) / 1000 / 60 / 60 / 24 / 30);
}

calMonthRange("2017-08", "2018-04")


/*
Debugging output
*/
9




/*
1 way apply code
*/

function formatMonth(date) {
var d = new Date(date),
month = '' + (d.getMonth() + 1),
year = d.getFullYear();

if (month.length < 2) month = '0' + month;

return [year, month].join('-');
}

function calMonthRange(val1, val2)
{
var FORMAT = "-";
if (val1.length != 7 || val2.length != 7)
return null;
if (val1.indexOf(FORMAT) < 0 || val2.indexOf(FORMAT) < 0)
return null;
var start_dt = val1.split(FORMAT);
var end_dt = val2.split(FORMAT);
start_dt[1] = (Number(start_dt[1]) - 1) + "";
end_dt[1] = (Number(end_dt[1]) - 1) + "";
var from_dt = new Date(start_dt[0], start_dt[1]);
var to_dt = new Date(end_dt[0], end_dt[1]);
return Math.ceil((to_dt.getTime() - from_dt.getTime()) / 1000 / 60 / 60 / 24 / 30);
}

for(var i=0; i<calMonthRange("2017-08", "2018-04"); i++) {
    console.log(formatMonth(new Date("2017-08").setMonth(new Date("2017-08").getMonth() + i)))
}



/*
Debugging output
*/
2017-08
2017-09
2017-10
2017-11
2017-12
2018-01
2018-02
2018-03
2018-04




2 way will be calculate about YYYY-MM-DD - YYYY-MM-DD

function calDateRange(val1, val2)
{
var FORMAT = "-";
if (val1.length != 10 || val2.length != 10)
return null;
if (val1.indexOf(FORMAT) < 0 || val2.indexOf(FORMAT) < 0)
return null;
var start_dt = val1.split(FORMAT);
var end_dt = val2.split(FORMAT);
start_dt[1] = (Number(start_dt[1]) - 1) + "";
end_dt[1] = (Number(end_dt[1]) - 1) + "";
var from_dt = new Date(start_dt[0], start_dt[1], start_dt[2]);
var to_dt = new Date(end_dt[0], end_dt[1], end_dt[2]);
return (to_dt.getTime() - from_dt.getTime()) / 1000 / 60 / 60 / 24;
}

calDateRange("2018-03-22", "2018-04-24")


/*
Debugging output
*/
33




/*
2 way apply code
*/

function formatDate(date) {
var d = new Date(date),
month = '' + (d.getMonth() + 1),
day = '' + d.getDate(),
year = d.getFullYear();

if (month.length < 2) month = '0' + month;
if (day.length < 2) day = '0' + day;

return [year, month, day].join('-');
}

function calDateRange(val1, val2)
{
var FORMAT = "-";
if (val1.length != 10 || val2.length != 10)
return null;
if (val1.indexOf(FORMAT) < 0 || val2.indexOf(FORMAT) < 0)
return null;
var start_dt = val1.split(FORMAT);
var end_dt = val2.split(FORMAT);
start_dt[1] = (Number(start_dt[1]) - 1) + "";
end_dt[1] = (Number(end_dt[1]) - 1) + "";
var from_dt = new Date(start_dt[0], start_dt[1], start_dt[2]);
var to_dt = new Date(end_dt[0], end_dt[1], end_dt[2]);
return (to_dt.getTime() - from_dt.getTime()) / 1000 / 60 / 60 / 24;
}

for(var i=0; i<calDateRange("2018-03-22", "2018-04-24"); i++) {
console.log(formatDate(new Date("2018-03-22").setDate(new Date("2018-03-22").getDate() + i)))
}



/*
Debugging output
*/
2018-03-22
2018-03-23
2018-03-24
2018-03-25
2018-03-26
2018-03-27
2018-03-28
2018-03-29
2018-03-30
2018-03-31
2018-04-01
2018-04-02
2018-04-03
2018-04-04
2018-04-05
2018-04-06
2018-04-07
2018-04-08
2018-04-09
2018-04-10
2018-04-11
2018-04-12
2018-04-13
2018-04-14
2018-04-15
2018-04-16
2018-04-17
2018-04-18
2018-04-19
2018-04-20
2018-04-21
2018-04-22
2018-04-23




'프로그래밍' 카테고리의 다른 글

python pyodbc 설치 탐험기  (0) 2018.06.04
[javascript] calculate datetime  (0) 2018.04.24
[javascript] get ip only using javascript  (5) 2018.04.19
python ctypes GetFileVersion  (0) 2016.11.09
python 윈도우 한글문제  (0) 2016.04.26
python unicode unescape (html unescape)  (0) 2015.11.07
이 댓글을 비밀 댓글로