[SOLVED] Proxmox 5.0 user start up scripts.

tomtom13

Well-Known Member
Dec 28, 2016
84
5
48
42
Hi, this is kinda trivial question, but I found usual scripts that should run at the end of level 6 init process but since proxmox and the rest of the world is mowing towards systemd it's all a bit messy to me and it seems that usual suspects don't get run as last ...

Also I would like the run the script when
- proxmox is considered "up and running"
- ceph is considered up and running (at least all systemd starting processes)

this is because I'm intending to mount cephfs to a specific folder and doing it from fstab is just to early.
 
Thing is that @reboot will run at the point where console is initiated (level 6 when login prompt shows up) - while ceph services are actually still starting up. I've added ceph-mds@0 and you can see that one still being in state starting up (along with whole load of ceph-osd@0 services)

I'll look into timers, still It would be nice if there was a default user script in proxmox which i being run when proxmox is fully up but before any VM will run and a script that will be executed afterwards.

Any other advice appreciated.
 
Thing is that @reboot will run at the point where console is initiated (level 6 when login prompt shows up) - while ceph services are actually still starting up. I've added ceph-mds@0 and you can see that one still being in state starting up (along with whole load of ceph-osd@0 services)

I'll look into timers, still It would be nice if there was a default user script in proxmox which i being run when proxmox is fully up but before any VM will run and a script that will be executed afterwards.

Any other advice appreciated.

the on boot guests are started by pveproxy (non HA) and pve-ha-lrm (HA), so just order yourself between those and whatever you need (pve-cluster for pmxcfs, storage units for various storages, ...).
 
So, thanks for all the replies - it got me going the right way.

I anybody ever looks for stuff like that, here is my dirty script:

/etc/systemd/system/multi-user.target.wants/mount-cephfs.service

Code:
[Unit]
Description=Mount cephsFS info /cephfs
ConditionPathExists=/cephfs
Wants=pve-cluster.service
Wants=pvedaemon.service
Wants=ssh.service
Wants=remote-fs.target
Wants=pveproxy.service
Wants=ceph-mds@0.service
After=pve-cluster.service
After=pvedaemon.service
After=ssh.service
After=remote-fs.target
After=ceph.service
After=sheepdog.service
After=glusterd.service
After=ceph-mds@0.service
Before=pveproxy.service

[Service]
ExecStartPre=/bin/sleep 30
ExecStart=/bin/mount /cephfs
ExecStop=/bin/umount /cephfs
Type=oneshot
RemainAfterExit=yes

[Install]
WantedBy=multi-user.target


Just "FYI"
this script is not perfect, and if you woke up to a cluster that is broken and it's in warn / error and can't mount this script will fail anyway.
 

About

The Proxmox community has been around for many years and offers help and support for Proxmox VE, Proxmox Backup Server, and Proxmox Mail Gateway.
We think our community is one of the best thanks to people like you!

Get your subscription!

The Proxmox team works very hard to make sure you are running the best software and getting stable updates and security enhancements, as well as quick enterprise support. Tens of thousands of happy customers have a Proxmox subscription. Get yours easily in our online shop.

Buy now!