crontab添加时间

1)/usr/local/src/datecrontalog.sh

#!/bin/bash

if [ $# -gt 1 ]; then
    istring=''
    #去掉回车
    date=`date | tr -s ["\n"]`
    for (( i = 2; i <= $#; i++ ))
    do
        string=$string" "${!i}
    done
    c=$date": "$string
    echo "" >> $1
    echo $c >> $1
fi

2)

*/1 * * * * /opt/otrs/bin/otrs.Console.pl Maint::Cache::Delete --type Group 2>&1 | xargs /usr/local/src/datecrontalog.sh /tmp/otrs_de

posted on 2017-11-10 10:11  xianguang  阅读(275)  评论(0编辑  收藏  举报

导航