서버 재부팅시 어떤 사용자로 로그인 되는지 와 상관없이

특정 사용자로 스크립트를 실행하고 싶었다

 

그러던 중 crontab에서 @reboot 라는 옵션을 사용하면 된다는 걸 알게 되었다.

 

로그는

/var/log/secure

/var/log/cron

위의 두 개의 파일을 참조 했다.

 

Feb 19 10:51:28 host01 crond[1207]: (test_user) FAILED to authorize user with PAM (Authentication token is no longer valid; new one required)

 

비밀번호 문제일 수 있어 확인하니 비밀번호가

만료라고 나옴

chage -l test_user

 

비밀번호 만료일자 비활성화 후 실행하니 PAM관련 에러메세지가 더 이상 나타나지 않음

sudo chage -M -1 test_user

 

0 30 * * 5 /home/test_user/test.sh

or

0 30 * * 5 cd /home/test_user && ./test.sh

 

'Linux' 카테고리의 다른 글

/run,tmpfs, journalctl  (0) 2025.03.19
자바 버전 설정 alternatives  (0) 2025.03.11
ssh config ssd-add  (1) 2024.12.29
2 Too Many authentication failure  (1) 2024.12.02
session 접속 제한 Too many authentication failures  (1) 2024.08.26

+ Recent posts