목차

anacron

특정 사용자로 재실행하기

#!/bin/sh
# If started as root, then re-start as user "gavenkoa":
if [ "$(id -u)" -eq 0 ]; then # root는 id가 0
    exec sudo -H -u gavenkoa $0 "$@" # 핵심부.
    echo "This is never reached.";
fi
 
echo "This runs as user $(id -un)";
# prints "gavenkoa"
 
exit 0;
#!/bin/sh
sudo -u kwon37xi echo "This runs as user $(id -un)";
exit 0;

Logging

# /var/log/syslog 로 남기기
 
somecmd 2>&1 | logger -i

참조