Commit 571f69db authored by Fidel Rodriguez Lopez's avatar Fidel Rodriguez Lopez

logrotate: add logrotate daemon with crond

parent df5ce92a
......@@ -2463,7 +2463,7 @@ BR2_PACKAGE_BASH=y
# BR2_PACKAGE_GNUPG2 is not set
# BR2_PACKAGE_INOTIFY_TOOLS is not set
# BR2_PACKAGE_LOCKFILE_PROGS is not set
# BR2_PACKAGE_LOGROTATE is not set
BR2_PACKAGE_LOGROTATE=y
# BR2_PACKAGE_LOGSURFER is not set
# BR2_PACKAGE_PINENTRY is not set
# BR2_PACKAGE_RANGER is not set
......
*/10 * * * * logrotate /etc/logrotate.conf
#!/bin/sh
#
# Load/Unload the crond daemon service
#
#
COUNTER_FILE="/tmp/start_cnt_crond"
DAEMON_EXEC=/usr/sbin/crond
DAEMON_PID=/var/run/crond.pid
DAEMON_NAME="crond"
DAEMON_ARGS="-b -c /etc/cron "
start_counter() {
# increase boot counter
START_COUNTER=1
if [ -f "$COUNTER_FILE" ];
then
read -r START_COUNTER < $COUNTER_FILE
START_COUNTER=$((START_COUNTER+1))
fi
echo "$START_COUNTER" > $COUNTER_FILE
}
start() {
echo -n "Starting ${DAEMON_NAME} daemon: "
# note start-stop-daemon does not create pidfile, only check if pid is
# running
start-stop-daemon -q -p ${DAEMON_PID} -S \
--exec ${DAEMON_EXEC} -- ${DAEMON_ARGS}
ret=$?
if [ $ret -eq 0 ]; then
start_counter
echo "OK"
elif [ $ret -eq 1 ]; then
echo "Failed (already running?)"
else
echo "Failed"
fi
}
stop() {
echo -n "Stopping ${DAEMON_NAME} daemon: "
start-stop-daemon -K -q -p ${DAEMON_PID}
if [ $? -eq 0 ]; then
echo "OK"
else
echo "Failed"
fi
}
restart() {
stop
start
}
case "$1" in
start)
start
;;
stop)
stop
;;
restart|reload)
restart
;;
*)
echo -e "Usage: $0 {start|force-start|stop|restart} \n"
exit 1
esac
exit $?
include /etc/logrotate.d
create
rotate 3
/var/log/*.log
{
su root root
size 5M
copytruncate
compress
}
../init.d/crond
\ No newline at end of file
../init.d/crond
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment