You are not logged in.

#1 2022-11-03 17:45:31

hirnschmalz
Member
Registered: 2020-11-19
Posts: 36

Create directory at startup

I'm using SOGo in combination with fetchmail on one of my servers. fetchmail requires the directory /var/lock/fetchmail.

I can create this directory manually, but after a reboot the directory is not available. What's the preferred way to persist such a directory?

Offline

#2 2022-11-03 17:52:25

Trilby
Inspector Parrot
Registered: 2011-11-29
Posts: 30,330
Website

Re: Create directory at startup

Are you using your own build of fetchmail, or your own variant of the service files?  Fetchmail from the repos uses /var/run/ for the pid file as a default and the packaged service file overrides this to use /run/fetchmail/ which is created (via systemd-tmpfiles).  Why is your implementation trying to use /var/lock/?

Last edited by Trilby (2022-11-03 23:35:29)


"UNIX is simple and coherent" - Dennis Ritchie; "GNU's Not Unix" - Richard Stallman

Offline

#3 2022-11-03 19:58:40

seth
Member
Registered: 2012-09-03
Posts: 59,205

Re: Create directory at startup

but after a reboot the directory is not available

And why is /var a tmpfs?

Online

#4 2022-11-04 05:31:04

hirnschmalz
Member
Registered: 2020-11-19
Posts: 36

Re: Create directory at startup

The fetchmail.pl is provided by the postfixadmin community package.

# file: /usr/share/doc/postfixadmin/ADDITIONS/fetchmail.pl

# Where to create a lockfile; please ensure path exists.
our $run_dir="/var/lock/fetchmail";

I just had a look in the /run directory and there is already a fetchmail directory but I don't know where it comes from. But if I understand you correctly the /run/fetchmail directory would be the correct place to put lockfiles into.

Offline

#5 2022-11-04 13:32:11

Trilby
Inspector Parrot
Registered: 2011-11-29
Posts: 30,330
Website

Re: Create directory at startup

You left out the line of that file directing you to change those values as needed.  There is no objectively "correct" place to put the lockfile - the location just needs to exist.  So rather than trying to create a location on every boot, just use one of the several existing and perfectly suitable locations (i.e., the ones fetchmail itself would use).

However, seth's question about why your /var seems to be a tmpfs is still relevant.


"UNIX is simple and coherent" - Dennis Ritchie; "GNU's Not Unix" - Richard Stallman

Offline

#6 2022-11-04 14:44:58

hirnschmalz
Member
Registered: 2020-11-19
Posts: 36

Re: Create directory at startup

My /var is no tmpfs that's why I'm so confused that the directory is gone after a reboot

df -h
Filesystem      Size  Used Avail Use% Mounted on
dev             2.0G     0  2.0G   0% /dev
run             2.0G  804K  2.0G   1% /run
/dev/sda1        18G   12G  4.9G  71% /
tmpfs           2.0G  232K  2.0G   1% /dev/shm
tmpfs           2.0G   28K  2.0G   1% /tmp
/dev/sdb         30G  3.2G   25G  12% /home
tmpfs           393M  4.0K  393M   1% /run/user/1000

Offline

#7 2022-11-04 15:01:33

seth
Member
Registered: 2012-09-03
Posts: 59,205

Re: Create directory at startup

Is it more after a reboot or more after terminating postfixadmin ?
Do you run any nonsense like bleachbit?

You could shut down the system and boot a live distro to see whether it's actually removed during the shutdown or the system boot.

Online

#8 2022-11-04 16:02:36

Raynman
Member
Registered: 2011-10-22
Posts: 1,539

Re: Create directory at startup

/run is tmpfs and /var/lock is symlinked to /run/lock.

Offline

#9 2022-11-04 17:31:23

hirnschmalz
Member
Registered: 2020-11-19
Posts: 36

Re: Create directory at startup

Ah ok, now I see. Thank you for the hint. This makes things clear.

ls -lha /var/lock
lrwxrwxrwx 1 root root 11 Oct 18 23:01 /var/lock -> ../run/lock

Offline

Board footer

Powered by FluxBB