0
0
mirror of https://github.com/Doodle3D/doodle3d-firmware.git synced 2024-12-22 19:13:49 +01:00

Log rotation:

- create cron job in postinst;
- start+enable cron in postinst.
This commit is contained in:
Wouter R 2016-03-18 11:31:07 +01:00
parent 4165d3b46d
commit 584a5bfce2

View File

@ -76,11 +76,11 @@ fi
#preserve saved sketches during firmware update #preserve saved sketches during firmware update
echo "/root/sketches" >> $IPKG_INSTROOT/etc/sysupgrade.conf echo "/root/sketches" >> $IPKG_INSTROOT/etc/sysupgrade.conf
### Finally make sure basic configuration is set correctly ### Finally make sure basic configuration is set correctly
$IPKG_INSTROOT/etc/init.d/wifibox enable LOGROTATE_CRON_LINE="*/3 * * * * /usr/sbin/logrotate /etc/logrotate.conf"
$IPKG_INSTROOT/etc/init.d/wifibox start
$IPKG_INSTROOT/etc/init.d/dhcpcheck enable
if [ -z "$IPKG_INSTROOT" ]; then if [ -z "$IPKG_INSTROOT" ]; then
# No installation root, we are being installed on a live box so run uci commands directly. # No installation root, we are being installed on a live box so run uci commands directly.
@ -105,6 +105,13 @@ if [ -z "$IPKG_INSTROOT" ]; then
uci -q delete wifibox.system.loglevel # remove key used in older versions (<=0.10.8a) if it exists uci -q delete wifibox.system.loglevel # remove key used in older versions (<=0.10.8a) if it exists
uci commit wifibox uci commit wifibox
crontab -l 2> /dev/null | grep logrotate\.conf > /dev/null
if [ $? -ne 0 ]; then
# add line, method from http://askubuntu.com/a/58582
# Note: `crontab -l` will throw an error to stderr because the file does not exist, but that does not matter
(crontab -l 2> /dev/null; echo "$LOGROTATE_CRON_LINE" ) | crontab -
fi
else else
# Create a script to setup the system as wifibox, it will be deleted after it has been run, except if it returns > 0. # Create a script to setup the system as wifibox, it will be deleted after it has been run, except if it returns > 0.
@ -127,10 +134,23 @@ else
uci set wifibox.general.system_log_level='info' uci set wifibox.general.system_log_level='info'
uci -q delete wifibox.system.loglevel # remove key used in older versions (<=0.10.8a) if it exists uci -q delete wifibox.system.loglevel # remove key used in older versions (<=0.10.8a) if it exists
crontab -l 2> /dev/null | grep logrotate\.conf > /dev/null
if [ $? -ne 0 ]; then
# add line, method from http://askubuntu.com/a/58582
# Note: `crontab -l` will throw an error to stderr because the file does not exist, but that does not matter
(crontab -l 2> /dev/null; echo "$LOGROTATE_CRON_LINE" ) | crontab -
fi
exit 0 exit 0
EOM EOM
echo "WARNING: WiFiBox network configuration can only be fully prepared when installing on real device" echo "WARNING: WiFiBox network configuration can only be fully prepared when installing on real device"
fi fi
$IPKG_INSTROOT/etc/init.d/wifibox enable
$IPKG_INSTROOT/etc/init.d/wifibox start
$IPKG_INSTROOT/etc/init.d/dhcpcheck enable
$IPKG_INSTROOT/etc/init.d/cron enable
$IPKG_INSTROOT/etc/init.d/cron start
exit 0 exit 0