Hi. On Thu, Mar 16, 2023 at 02:20:39AM +0800, cor...@free.fr wrote: > On 16/03/2023 02:08, Greg Wooledge wrote: > > On Thu, Mar 16, 2023 at 02:02:35AM +0800, cor...@free.fr wrote: > > > I am having the question that why the dir I created in /var/run disappears > > > after rebooting the system? how to prevent that? > > > > unicorn:~$ ls -ld /var/run > > lrwxrwxrwx 1 root root 4 Jan 11 2018 /var/run -> /run/ > > unicorn:~$ df /run > > Filesystem 1K-blocks Used Available Use% Mounted on > > tmpfs 1215596 1928 1213668 1% /run > > > > Because /var/run is a symlink to /run which is a transient, in-memory > > file system not backed by permanent storage. > > > > Thanks greg. > > I have put these statement in @reboot crontab for auto startup. > > @reboot mkdir -p /var/run/xxx && chown -R www-data:www-data /var/run/xxx
I'd use systemd-tmpfiles(8) for that. Just because you probably want that directory to exist before your webserver starts up and not in the arbitrary point in the future. Something like this should do it for you: cat > /etc/tmpfiles.d/xxx.conf << EOF d /run/xxx 0755 www-data www-data EOF Reco