Skip to content

Commit a6ef3da

Browse files
Update zram-config
1 parent 6b8fb1a commit a6ef3da

File tree

1 file changed

+4
-5
lines changed

1 file changed

+4
-5
lines changed

zram-config

+4-5
Original file line numberDiff line numberDiff line change
@@ -61,10 +61,9 @@ createZlog () {
6161
journalctl --flush >>${ZLOG} 2>&1 || return 1
6262
if [ ! -z "$OLDLOG_DIR" ]
6363
then
64-
cp -arvf /etc/logrotate.conf ${ZSHARE}/logrotate.conf.bak >>${ZLOG} 2>&1 || return 1
65-
sed -i "/^weekly.*/i olddir ${ZDIR}${OLDLOG_DIR}" /etc/logrotate.conf >>${ZLOG} 2>&1 || return 1
66-
sed -i "/^weekly.*/i createolddir 755 root root" /etc/logrotate.conf >>${ZLOG} 2>&1 || return 1
67-
sed -i "/^weekly.*/i renamecopy" /etc/logrotate.conf >>${ZLOG} 2>&1 || return 1
64+
echo "olddir "${ZDIR}${OLDLOG_DIR} > /etc/logrotate.d/00_oldlog
65+
echo "createolddir 755 root root" >> /etc/logrotate.d/00_oldlog
66+
echo "renamecopy" >> /etc/logrotate.d/00_oldlog
6867
else
6968
echo "createZlog no oldlog dir in ztab" >>${ZLOG}
7069
fi
@@ -112,7 +111,7 @@ mergeOverlay () {
112111
removeZlog () {
113112
if [ ! -z "$OLDLOG_DIR" ]
114113
then
115-
cp -arvf ${ZSHARE}/logrotate.conf.bak /etc/logrotate.conf >>${ZLOG} 2>&1 || return 1
114+
rm /etc/logrotate.d/00_oldlog
116115
fi
117116
echo "$ZRAM_DEV" >>${ZLOG}
118117
#syncToDisk

0 commit comments

Comments
 (0)