#! /bin/bash
log_dir=/var/log
root_uid=0
if [ "$UID" -ne $root_uid ];then
echo "This account not permission to execute."
exit 1
fi
cd $log_dir
if [ $? -ne 0 ];then
echo "This path not exists."
exit 1
else
cat /dev/null > messages
echo "clear logs jobs finished."
fi
转载于:https://blog.51cto.com/546136/2056588