Answer the question
In order to leave comments, you need to log in
How to create a folder structure in tmpfs on boot?
Good day.
On the laptop with ubuntu, there is a lamp and the /var/log folder is configured to be mounted as tmpfs, so as not to once again force the SSD disk with Apache logs (they are only needed while I work, so it makes no sense to store them on the disk)
But there was a problem: Apache does not start , until you create the /var/log/apache2 folder and, accordingly, every time you have to create this directory after the system boots and start it manually.
To solve the problem, I created the /etc/rc.local file in which I wrote the following script (found on the open spaces of the tyrnet, adapted to my needs):
#!/bin/sh -e
for d in fsck apt installer upstart dist-upgrade samba unattended-upgrades cups mpd hp lightdm apache2 nginx postfix; do
[ -d /var/log/$d ] || mkdir /var/log/$d
done
exit 0
Answer the question
In order to leave comments, you need to log in
Turn off the logs completely, since they have no value anyway.
create a service for systemd with the launch of entogo script.
prescribe in it a mandatory launch of it before the services waiting for it. those. enter the line
names and the need for services, see in your system.
description https://www.freedesktop.org/software/systemd/man/s...
then enable the service to boot and reboot the system. everything should start automatically.
to enable/disable this service together with the test subjects, add the BindsTo= option,
but you will have to add a script for unmounting the temps and freeing memory.
by the way, as an option, redirect all specified dirs to /run with softlinks and complete the crap cleaning script from the corresponding /run directories.
in general, think / study - options for a wagon and a small cart.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question