슬로우 로그를 남기려면 데몬 실행시 --log-slow-queries 라는 옵션을 준다.

 safe_mysqld --log-slow-queries=slow_query.log


그런데 20 초 이상의 긴 쿼리 시간을 가지는 것만 저장하겠다고 한다면  다음의 옵션을 준다.

 

 

$ safe_mysqld --log-slow-queries=slow_query.log -O long_query_time=20

 

 

또는 my.cnf 파일에 다음에 내용을 지정한다.

 log-slow-queries = /var/log/mysql/mysql-slow.log
long_query_time = 1


 

Posted by '김용환'
,

 

bash에서 || (logical or)을 사용할 때, ';' 을 사용하지 않는다.

 

if 문 예제

 if [ ${IP} == '' ]; then
        IP="-"
        m=`expr $m + 1`
        continue
    fi

 

 

 logical OR을 썼을때, ; 을 쓰지 않는 것을 유의

     if  [ ${HOSTS[$m]} == '-' ] || [ ${HOSTS[$m]} == '' ]
    then
        m=`expr $m + 1`
        continue
    fi

 

그러나 문자열을 비교할 때는 ""(double quotation mark)을 잘 활용해야 한다.  

[: ==: unary operator expected


첫번째 아규먼트를 받아올 때, $opt라는 변수에 저장하고 변수와 비교할 때는 ""(double quotation mark)를 이용해서 작업하면 에러가 발생하지 않고 잘 작동한다.

#/bin/sh


opt=$1


if [ "$opt" == 'test' ] || [ "$opt" == 'aaa' ]

then

  echo "xxx"

fi



 

출처 :

 

http://idaemon.com.ne.kr/Linux/Bash/operations.html#ANDOR

 

 

 

 

3.6. 연산자 이야기

3.6.1. 연산자

=

산술식과 문자열 대입 모두를 알아서 해주는 다기능 대입 연산자

var=27
category=minerals

문자열 비교에서도 쓰일 수 있습니다.

if [ $string1 = $string2 ]
then
   command
fi

다음 연산자들은 보통 expr 이나 let과 같이 많이 쓰입니다.

산술 연산

+

더하기

-

빼기

*

곱하기

/

나누기

%

나머지(정수 나누기에서 나머지 값)

+=

"plus-equal" (변수를 상수값만큼 증가)

`expr $var+=5`var5 만큼 증가.

-=

"minus-equal" (변수를 상수값 만큼 감소)

*=

"times-equal" (변수를 상수값의 배수 만큼 증가)

`expr $var*=4`var4배 증가.

/=

"slash-equal" (변수를 상수값으로 나눔)

%=

"mod-equal" (변수를 상수로 나눈 나머지 값)

비트 단위 논리 연산은 쉘 스크립트에서 자주 쓰이지는 않지만 포트나 소켓쪽에서 주로 쓰입니다. "비트 조작"은 속도가 빠른 C나 C++같은 컴파일 언어쪽에 더 관련이 있습니다.

<<

비트 왼쪽 쉬프트 (쉬프트 연산 한번당 2로 곱함)

<<=

"left-shift-equal"

"var <<= 2"var2 비트만큼 왼쪽으로 쉬프트 (4로 곱함)

>>

비트 오른쪽 쉬프트 (비트 연산 한번당 2로 나눔)

>>=

"right-shift-equal" (<<=와 반대)

&

비트 AND

&=

"비트 AND-EQUAL"

|

비트 OR

|=

"비트 OR-equal"

~

비트 negate

!

비트 NOT

^

비트 XOR

^=

"비트 XOR-equal"

관련 테스트

<

보다 작은

>

보다 큰

<=

보다 작거나 같은

>=

보다 크거나 같은

==

같은

!=

같지 않은

&&

논리 AND

if [ $condition1 ] && [ $condition2 ]
# condition1과 condition2가 둘 다 참이라면...

참고: && 는 상황에 따라 AND list에 쓰여서 명령어 여러개를 붙여서 쓸 때도 사용됩니다(3.21절 참고).

||

논리 OR

if [ $condition1 ] || [ $condition2 ]
# condition1이나 condition2 둘 중에 하나라도 참이라면...

예 3-15. && 와 ||를 쓴 복합 조건 테스트

#!/bin/bash

a=24
b=47

if [ $a -eq 24 ] && [ $b -eq 47 ]
then
  echo "#1 테스트 성공."
else
  echo "#1 테스트 실패."
fi

# ERROR:
# if [ $a -eq 24 && $b -eq 47 ]


if [ $a -eq 98 ] || [ $b -eq 47 ]
then
  echo "#2 테스트 성공."
else
  echo "#2 테스트 실패."
fi


# -a 와 -o 옵션은 복합 조건 테스트에서 쓸 수 있는
# 다른 방법입니다.
# 이 점을 지적해준 Patrick Callahan에게 감사를 표합니다.


if [ $a -eq 24 -a $b -eq 47 ]
then
  echo "#3 테스트 성공."
else
  echo "#3 테스트 실패."
fi


if [ $a -eq 98 -o $b -eq 47 ]
then
  echo "#4 테스트 성공."
else
  echo "#4 테스트 실패."
fi


a=rhino
b=crocodile
if [ $a = rhino ] && [ $b = crocodile ]
then
  echo "#5 테스트 성공."
else
  echo "#5 테스트 실패."
fi

exit 0

3.6.2. 숫자 상수

쉘 스크립트는 기본적으로 숫자를 10진수로 해석합니다. 만약에 숫자 앞에 0이 있다면 8 진수(8 진법)이고 0x가 있다면 16 진수(16 진법)입니다. #이 들어간 숫자는 진법#숫자로 해석합니다(이 때는 범위 제한이 있습니다).

예 3-16. 숫자 상수 표기법:

#!/bin/bash

# 숫자 표기법.

# 10진수
let "d = 32"
echo "d = $d"
# 별로 특별한 게 없습니다.


# 8진수: '0' 다음에 나오는 숫자
let "o = 071"
echo "o = $o"
# 결과는 10진수로 나타납니다.

# 16진수: '0x'나 '0X' 다음에 나오는 숫자
let "h = 0x7a"
echo "h = $h"

# 다른 진법: 진수#숫자
# 진수는(BASE)는 2 와 64 사이입니다.
let "b = 32#77"
echo "b = $b"
# 이 표기법은 아주 제한된 범위의 숫자에서만 동작합니다.
let "c = 2#47"  # Error: 범위 초과.
echo "c = $c"


exit 0


Posted by '김용환'
,

 projects=(`ls --color=none $dir | grep -E 'google_' | paste -s -d' '`)

echo "Target Project : ${projects}"
echo "number : ${#projects[@]}"

 

ls를 이용하여 간단한 배열을 만들 수 있다.

Posted by '김용환'
,

bash integer 비교

unix and linux 2007. 9. 11. 06:46

 

기본 중의 기본!!

 

 

 

출처 :

http://tldp.org/LDP/abs/html/comparison-ops.html

 

7.3. Other Comparison Operators

A binary comparison operator compares two variables or quantities. Note that integer and string comparison use a different set of operators.

integer comparison

-eq

is equal to

if [ "$a" -eq "$b" ]

-ne

is not equal to

if [ "$a" -ne "$b" ]

-gt

is greater than

if [ "$a" -gt "$b" ]

-ge

is greater than or equal to

if [ "$a" -ge "$b" ]

-lt

is less than

if [ "$a" -lt "$b" ]

-le

is less than or equal to

if [ "$a" -le "$b" ]

<

is less than (within double parentheses)

(("$a" < "$b"))

<=

is less than or equal to (within double parentheses)

(("$a" <= "$b"))

>

is greater than (within double parentheses)

(("$a" > "$b"))

>=

is greater than or equal to (within double parentheses)

(("$a" >= "$b"))

string comparison

=

is equal to

if [ "$a" = "$b" ]

==

is equal to

if [ "$a" == "$b" ]

This is a synonym for =.

The == comparison operator behaves differently within a double-brackets test than within single brackets.

[[ $a == z* ]]    # True if $a starts with an "z" (pattern matching).
[[ $a == "z*" ]]  # True if $a is equal to z* (literal matching).

[ $a == z* ]      # File globbing and word splitting take place.
[ "$a" == "z*" ]  # True if $a is equal to z* (literal matching).

# Thanks, Stéphane Chazelas

!=

is not equal to

if [ "$a" != "$b" ]

This operator uses pattern matching within a [[ ... ]] construct.

<

is less than, in ASCII alphabetical order

if [[ "$a" < "$b" ]]

if [ "$a" \< "$b" ]

Note that the "<" needs to be escaped within a [ ] construct.

>

is greater than, in ASCII alphabetical order

if [[ "$a" > "$b" ]]

if [ "$a" \> "$b" ]

Note that the ">" needs to be escaped within a [ ] construct.

See Example 26-11 for an application of this comparison operator.

-n

string is not "null."

The -n test absolutely requires that the string be quoted within the test brackets. Using an unquoted string with ! -z, or even just the unquoted string alone within test brackets (see Example 7-6) normally works, however, this is an unsafe practice. Always quote a tested string. [1]

-z

string is "null, " that is, has zero length

Example 7-5. Arithmetic and string comparisons

#!/bin/bash

a=4
b=5

#  Here "a" and "b" can be treated either as integers or strings.
#  There is some blurring between the arithmetic and string comparisons,
#+ since Bash variables are not strongly typed.

#  Bash permits integer operations and comparisons on variables
#+ whose value consists of all-integer characters.
#  Caution advised, however.

echo

if [ "$a" -ne "$b" ]
then
  echo "$a is not equal to $b"
  echo "(arithmetic comparison)"
fi

echo

if [ "$a" != "$b" ]
then
  echo "$a is not equal to $b."
  echo "(string comparison)"
  #     "4"  != "5"
  # ASCII 52 != ASCII 53
fi

# In this particular instance, both "-ne" and "!=" work.

echo

exit 0

Example 7-6. Testing whether a string is null

#!/bin/bash
#  str-test.sh: Testing null strings and unquoted strings,
#+ but not strings and sealing wax, not to mention cabbages and kings . . .

# Using   if [ ... ]


# If a string has not been initialized, it has no defined value.
# This state is called "null" (not the same as zero).

if [ -n $string1 ]    # $string1 has not been declared or initialized.
then
  echo "String \"string1\" is not null."
else  
  echo "String \"string1\" is null."
fi  
# Wrong result.
# Shows $string1 as not null, although it was not initialized.


echo


# Lets try it again.

if [ -n "$string1" ]  # This time, $string1 is quoted.
then
  echo "String \"string1\" is not null."
else  
  echo "String \"string1\" is null."
fi                    # Quote strings within test brackets!


echo


if [ $string1 ]       # This time, $string1 stands naked.
then
  echo "String \"string1\" is not null."
else  
  echo "String \"string1\" is null."
fi  
# This works fine.
# The [ ] test operator alone detects whether the string is null.
# However it is good practice to quote it ("$string1").
#
# As Stephane Chazelas points out,
#    if [ $string1 ]    has one argument, "]"
#    if [ "$string1" ]  has two arguments, the empty "$string1" and "]" 



echo



string1=initialized

if [ $string1 ]       # Again, $string1 stands naked.
then
  echo "String \"string1\" is not null."
else  
  echo "String \"string1\" is null."
fi  
# Again, gives correct result.
# Still, it is better to quote it ("$string1"), because . . .


string1="a = b"

if [ $string1 ]       # Again, $string1 stands naked.
then
  echo "String \"string1\" is not null."
else  
  echo "String \"string1\" is null."
fi  
# Not quoting "$string1" now gives wrong result!

exit 0
# Thank you, also, Florian Wisser, for the "heads-up".

Example 7-7. zmore

#!/bin/bash
# zmore

#View gzipped files with 'more'

NOARGS=65
NOTFOUND=66
NOTGZIP=67

if [ $# -eq 0 ] # same effect as:  if [ -z "$1" ]
# $1 can exist, but be empty:  zmore "" arg2 arg3
then
  echo "Usage: `basename $0` filename" >&2
  # Error message to stderr.
  exit $NOARGS
  # Returns 65 as exit status of script (error code).
fi  

filename=$1

if [ ! -f "$filename" ]   # Quoting $filename allows for possible spaces.
then
  echo "File $filename not found!" >&2
  # Error message to stderr.
  exit $NOTFOUND
fi  

if [ ${filename##*.} != "gz" ]
# Using bracket in variable substitution.
then
  echo "File $1 is not a gzipped file!"
  exit $NOTGZIP
fi  

zcat $1 | more

# Uses the filter 'more.'
# May substitute 'less', if desired.


exit $?   # Script returns exit status of pipe.
# Actually "exit $?" is unnecessary, as the script will, in any case,
# return the exit status of the last command executed.

compound comparison

-a

logical and

exp1 -a exp2 returns true if both exp1 and exp2 are true.

-o

logical or

exp1 -o exp2 returns true if either exp1 or exp2 are true.

These are similar to the Bash comparison operators && and ||, used within double brackets.

[[ condition1 && condition2 ]]
The -o and -a operators work with the test command or occur within single test brackets.
if [ "$exp1" -a "$exp2" ]

Refer to Example 8-3, Example 26-16, and Example A-30 to see compound comparison operators in action.

Notes

[1]

As S.C. points out, in a compound test, even quoting the string variable might not suffice. [ -n "$string" -o "$a" = "$b" ] may cause an error with some versions of Bash if $string is empty. The safe way is to append an extra character to possibly empty variables, [ "x$string" != x -o "x$a" = "x$b" ] (the "x's" cancel out).

Posted by '김용환'
,

 

bash 첨 하는 사람은 이글이 꼭 도움 될꼉~~

 

 

참조

http://www.linuxcommand.org/wss0100.php

 

 

Stay Out Of Trouble

by William Shotts, Jr.

Now that our scripts are getting a little more complicated, I want to point out some common mistakes that you might run into. To do this, create the following script called trouble.bash. Be sure to enter it exactly as written.

#!/bin/bash

number=1

if [ $number = "1" ]; then
    echo "Number equals 1"
else
    echo "Number does not equal 1"
fi
       

When you run this script, it should output the line "Number equals 1" because, well, number equals 1. If you don't get the expected output, check your typing; you made a mistake.

Empty variables

Edit the script to change line 3 from:

number=1
       

to:

number=
       

and run the script again. This time you should get the following:

[me@linuxbox me]$ ./trouble.bash
/trouble.bash: [: =: unary operator expected.
Number does not equal 1

As you can see, bash displayed an error message when we ran the script. You probably think that by removing the "1" on line 3 it created a syntax error on line 3, but it didn't. Let's look at the error message again:

./trouble.bash: [: =: unary operator expected

We can see that ./trouble.bash is reporting the error and the error has to do with "[". Remember that "[" is an abbreviation for the test shell builtin. From this we can determine that the error is occurring on line 5 not line 3.

First, let me say there is nothing wrong with line 3. number= is perfectly good syntax. You will sometimes want to set a variable's value to nothing. You can confirm the validity of this by trying it on the command line:

[me@linuxbox me]$ number=
[me@linuxbox me]$

See, no error message. So what's wrong with line 5? It worked before.

To understand this error, we have to see what the shell sees. Remember that the shell spends a lot of its life substituting text. In line 5, the shell substitutes the value of number where it sees $number. In our first try (when number=1), the shell substituted 1 for $number like so:

if [ 1 = "1" ]; then
       

However, when we set number to nothing (number=), the shell saw this after the substitution:

if [ = "1" ]; then
       

which is an error. It also explains the rest of the error message we received. The "=" is a binary operator; that is, it expects two items to operate upon - one on each side. What the shell was trying to tell us was that there was only one item and there should have been a unary operator (like "!") that only operates on a single item.

To fix this problem, change line 5 to read:

if [ "$number" = "1" ]; then
       

Now when the shell performs the substitution it will see:

if [ "" = "1" ]; then
       

which correctly expresses our intent.

This brings up an important thing to remember when you are writing your scripts. Consider what happens if a variable is set to equal nothing.

Missing quotes

Edit line 6 to remove the trailing quote from the end of the line:

   echo "Number equals 1
       

and run the script again. You should get this:

[me@linuxbox me]$ ./trouble.bash
./trouble.bash: line 8: unexpected EOF while looking for matching "
./trouble.bash: line 10 systax error: unexpected end of file

Here we have another case of a mistake in one line causing a problem later in the script. What happens is the shell keeps looking for the closing quotation mark to tell it where the end of the string is, but runs into the end of the file before it finds it.

These errors can be a real pain to find in a long script. This is one reason you should test your scripts frequently when you are writing them so there is less new code to test. I also find that text editors with syntax highlighting (like nedit or kate) make these kinds of bugs easier to find.

Isolating problems

Finding bugs in your programs can sometimes be very difficult and frustrating. Here are a couple of techniques that you will find useful:

Isolate blocks of code by "commenting them out." This trick involves putting comment characters at the beginning of lines of code to stop the shell from reading them. Frequently, you will do this to a block of code to see if a particular problem goes away. By doing this, you can isolate which part of a program is causing (or not causing) a problem.

For example, when we were looking for our missing quotation we could have done this:

#!/bin/bash

number=1

if [ $number = "1" ]; then
    echo "Number equals 1
#else
#   echo "Number does not equal 1"
fi
       

By commenting out the else clause and running the script, we could show that the problem was not in the else clause even though the error message suggested that it was.

Use echo commands to verify your assumptions. As you gain experience tracking down bugs, you will discover that bugs are often not where you first expect to find them. A common problem will be that you will make a false assumption about the performance of your program. You will see a problem develop at a certain point in your program and assume that the problem is there. This is often incorrect, as we have seen. To combat this, you should place echo commands in your code while you are debugging, to produce messages that confirm the program is doing what is expected. There are two kinds of messages that you should insert.

The first type simply announces that you have reached a certain point in the program. We saw this in our earlier discussion on stubbing. It is useful to know that program flow is happening the way we expect.

The second type displays the value of a variable (or variables) used in a calculation or test. You will often find that a portion of your program will fail because something that you assumed was correct earlier in your program is, in fact, incorrect and is causing your program to fail later on.

Watching your script run

It is possible to have bash show you what it is doing when you run your script. To do this, add a "-x" to the first line of your script, like this:

#!/bin/bash -x
       

Now, when you run your script, bash will display each line (with substitutions performed) as it executes it. This technique is called tracing. Here is what it looks like:

[me@linuxbox me]$ ./trouble.bash
+ number=1
+ '[' 1 = 1 ']'
+ echo 'Number equals 1'
Number equals 1

Alternately, you can use the set command within your script to turn tracing on and off. Use set -x to turn tracing on and set +x to turn tracing off. For example.:

#!/bin/bash

number=1

set -x
if [ $number = "1" ]; then
    echo "Number equals 1"
else
    echo "Number does not equal 1"
fi
set +x
       
Posted by '김용환'
,

 

bash쉘에서 다음의 에러가 나면,

unary operator expected

 

타입을 의심하라!!!!

 

문자를 숫자에 비교하거나 그럴때 나는 것이다.

m=1
while [ $m -lt ${#projects[@]} ]
do
    echo $m;
    echo "$projects[$m] ..............."
    set properties = `grep -h 'real.ConnectionURL' /$projects[$m]/src/conf/*.properties | sed 's/real.ConnectionURL=jdbc://g' | paste -s -d' ' | tr '?' '-'`
    echo $properties
    m=`expr $m + 1`
done

 

bash는 반드시 expr를 써줘야 한다.

그렇지 않으면 문자로 인식하여...

unary operator expected  라는 에러가 난다.

 

csh과 bash은 너무 달라.

 

 

Posted by '김용환'
,

쉘 스크립트에서의 함수

 

난 csh은 모르니까. 그냥 bash로 얘기한다.

 

선언은 다음과 같다.

function 함수이름 {

}

 

이렇게 선언하고, 다음과 같이 사용한다.

 

 

#!/bin/bash

workspace="/home/www/work"

function do_run {
    CMD=$@
    eval 'expect.pl -s "rlogin -l www a69" -c "$CMD;exit" -timeout 600'
}

TARGET=$1
if [ -z $TARGET ]; then
    echo "Usage : rsync-images.sh "
    exit;
fi

CMD="rsync -av --exclude '*/CVS/*' /data/$TARGET han::avatar/"

echo "Target Servers a69"
do_run $CMD
~

 

파라미터는 함수에서 $1 $2  이렇게 토큰단위로 쓸 수 있고, 만약 전체 스트링을 다 받고 싶다면, $@ 이렇게 써주면 전체를 함수안으로 그대로 넣어줄 수 있다.

 

 

'c or linux' 카테고리의 다른 글

gethostbyname, getaddrinfo 사용한 샘플 소스  (0) 2008.02.26
awk상에서 시스템 명령어 사용하기  (0) 2008.02.13
ulimit  (0) 2007.09.10
crontab 에러  (0) 2007.09.08
crontab 디렉토리  (0) 2007.09.08
Posted by '김용환'
,

ulimit

c or linux 2007. 9. 10. 08:16


처리할수 있는 최대 파일수
[root@sky279 14:48:35 ~]# cat /proc/sys/fs/file-max
32768

limit의 결과는 계정마다 다르게 나온다.

[root@sky279 14:50:06 ~]# limit
cputime         unlimited
filesize        unlimited
datasize        unlimited
stacksize       8192 kbytes
coredumpsize    unlimited
memoryuse       unlimited
vmemoryuse      unlimited
descriptors     16000
memorylocked    unlimited
maxproc         16000

 

실제 소스 확인
[root@sky279 14:53:40 /usr/src/linux-2.4/include/linux]# cat limits.h
#ifndef _LINUX_LIMITS_H
#define _LINUX_LIMITS_H

#define NR_OPEN         1024

#define NGROUPS_MAX       32    /* supplemental group IDs are available */
#define ARG_MAX       131072    /* # bytes of args + environ for exec() */
#define CHILD_MAX        999    /* no limit :-) */
#define OPEN_MAX         256    /* # open files a process may have */
#define LINK_MAX         127    /* # links a file may have */
#define MAX_CANON        255    /* size of the canonical input queue */
#define MAX_INPUT        255    /* size of the type-ahead buffer */
#define NAME_MAX         255    /* # chars in a file name */
#define PATH_MAX        4096    /* # chars in a path name including nul */
#define PIPE_BUF        4096    /* # bytes in atomic write to a pipe */
#define XATTR_NAME_MAX   255    /* # chars in an extended attribute name */
#define XATTR_SIZE_MAX 65536    /* size of an extended attribute value (64k) */
#define XATTR_LIST_MAX 65536    /* size of extended attribute namelist (64k) */

#define RTSIG_MAX         32

#endif

 

참조하기.

http://www.osx86.org/study/linux/procfs.txt

'c or linux' 카테고리의 다른 글

awk상에서 시스템 명령어 사용하기  (0) 2008.02.13
쉘 스크립트에서의 함수 파라미터  (0) 2007.09.11
crontab 에러  (0) 2007.09.08
crontab 디렉토리  (0) 2007.09.08
Authentication token is no longer valid  (0) 2007.09.07
Posted by '김용환'
,

crontab 에러

c or linux 2007. 9. 8. 01:31

보통 crontab -e 명령어를 통해서 작업을 하다보면, 다음과 같은 에러가 난다.

 

crontab: installing new crontab
"/tmp/crontab.XXXXScNhd2":3: bad minute
errors in crontab file, can't install.
Do you want to retry the same edit?

 

그 이유는 다음과 같다.

 

문법에 맞는 cron 스타일로 입력하지 않았기 때문에 그런 에러가 나는 것이다.

또는 dos에서 사용되는 ^M$가 라인 뒤에 붙어 있어서 문제가 될 수 도 있다..

 

 

 

 

 

 

* 참고

http://www.linuxboxadmin.com/micro/micro-how%11tos/system-administration/crontab.html

Crontab fields

Here is how the fields are defined:

  1. minute
  2. hour
  3. day of the month
  4. month of the year
  5. day of the week
  6. program or command to run

An asterisk (*) in any field means run every time for this field. Ranges (X-Y) and steps (X-Y/Z) can also be defined.

User crontabs

To edit a user crontab (including root):
crontab -e

To delete a crontab:
crontab -r

System crontab

The system crontab is stored in /etc/crontab. It can be changed (as root) with a text editor.

The system crontab has one extra field before the program to run, which is the user to run the command as (usually root).

Error installing new crontab (bad minute)

I've received this cryptic error message while trying to update a crontab:

crontab: installing new crontab
"/tmp/crontab.XXXXScNhd2":3: bad minute
errors in crontab file, can't install.
Do you want to retry the same edit?

The error message suggests a format problem with my entry, but the real error is due to DOS line endings (CR LF) in the file. Unix/Linux line endings just use CR. If a crontab is installed without using the crontab -e command, this error might appear.

You can check the line endings by running:
cat -v -e -t /var/spool/cron/username
If you see "^M$" at the end of each line, the file has DOS line endings. Each line should just end with "$".

The fix is to run the dos2unix command on the crontab to correct the line endings:
dos2unix /var/spool/cron/username

 

 

Posted by '김용환'
,

crontab 디렉토리

c or linux 2007. 9. 8. 00:54

 

crontab 지정시 tmp 폴더에 임시로 저장된다.

/var/spool/cron 의 디렉토리는 sticky 이다.

 

그러나 user별 디렉토리가 ascii이건 graphic metafile이건 상관없이 작동이 된다.

 

[i55335:/tmp]# file /var/spool/cron/www
/var/spool/cron/www: character Computer Graphics Metafile
[i55335:/tmp]# file /var/spool/cron/weblog
/var/spool/cron/weblog: ASCII text

[i55335:/tmp]# ll .
ÇÕ°è 112
drwxrwxrwt    3 root     root         4096  9¿ù  7 15:38 .
drwxr-xr-x   21 root     root         4096  7¿ù  9 15:40 ..
-rw-------    1 weblog   weblog      12288  9¿ù  6 19:09 .crontab.XXXXVMHLei.swp
-rw-------    1 root     root          102  9¿ù  7 15:34 crontab.XXXX3mdMx6
-rw-------    1 weblog   weblog        123  9¿ù  6 16:57 crontab.XXXX5fBmlX
-rw-------    1 root     root          108  9¿ù  7 15:28 crontab.XXXXCCLpty

Posted by '김용환'
,