Page 1 of 1

/tmp and /var/log cleanup at boot

Posted: 23 Mar 2017, 09:07
by michalh
Hi,

I do not want to preserve changes to(in) /var/log and /tmp dirs, how to make them fresh clean at every boot?

Thanks, Michal

Re: /tmp and /var/log cleanup at boot

Posted: 23 Mar 2017, 21:48
by fulalas
Open /etc/rc.d/rc.local, create a new line in the end and put this:

Code: Select all

echo guest | sudo -S rm -rfd /var/log/*
echo guest | sudo -S rm -rfd /tmp/*
If you're not using save-changes cheatcode, then create /porteus/rootcopy/etc/rc.d/rc.local inside your Porteus bootable device and write the commands above.

Another option is to delete them at shutdown process. Use the same commands above, but inside: /etc/rc.d/rc.local_shutdown

Re: /tmp and /var/log cleanup at boot

Posted: 27 Mar 2017, 05:34
by michalh
rc.local is run before any other programs, which can write to /tmp and /var/log?

Re: /tmp and /var/log cleanup at boot

Posted: 27 Mar 2017, 05:55
by fulalas
Yes, it is. But maybe it's better to use the shutdown script :)

Re: /tmp and /var/log cleanup at boot

Posted: 29 Mar 2017, 11:43
by Bogomips
michalh wrote:rc.local is run before any other programs, which can write to /tmp and /var/log?
Not so sure here. In the Web seen posts asserting that rc.local is first to be run, but after doing a diagnostic, it seems rc.S runs before rc.local.