crontab 에서 locale 설정

biiiiid의 이미지

rsnapshot을 실행하는데,

crontab에서 실행하면 한글파일이 안되고,
cmdline에서 하면 잘 됩니다.

일단 crontab 에서의 locale 설정 문제인것 같은데요..

cmdline에서의 locale은 euckr입니다.
crontab에서 locale은 unset이거나, POSIX인것같은데요.
locale을 명시적으로 설정해줄 수는 없는지요?

root # crontab -l
LANG=ko_KR.euckr

...

등으로 설정해도 잘 안되네요...

아치리눅스 환경입니다..

익명 사용자의 이미지

LANG=ko_KR.euckr LC_ALL=ko_KR.euckr

로 한번 해보심은 ???

biiiiid의 이미지

googling해본 결과로는

일단 crontab자체로는 안되는 것 같고, ( man crontab)
cron deamon이 /etc/environment 파일을 참조한다고 하던데(일종의 버그..)
요즘에는 그렇지도 않은 것 같더군요..
별도의 shell script를 만들어서 거기서 environment 변수 설정하고,
원하는 명령어를 실행하는 방법으로 하고 있습니다만..

더 간단한 방법이 있을 것 같은데요...

$ man crontab
...
       Unlike other cron daemons, this crond/crontab package doesn't try to do everything under the sun.  It doesn't try to keep  track  of  user's  pre-
       ferred  shells;  that would require special-casing users with no login shell.  Instead, it just runs all commands using /bin/sh.  (Commands can of
       course be script files written in any shell you like.)
 
       Nor does it do any special environment handling.  A shell script is better-suited to doing that than a cron daemon.  This cron daemon sets up only
       four environment variables: USER, LOGNAME, HOME, and SHELL.
...
익명 사용자의 이미지

훔... 지금 하시는 것처럼 스크립트 하나짜서 처리하는게
제일 나을 듯 합니다.

스크립트로 하면 안되는 특별한 이유가 없는 이상은요;;