Set delay for Apps Start After Server Reboot

Fleshmauler

Explorer
Joined
Jan 26, 2022
Messages
79
Hello All,

I have a few scripts that run on boot that require a minute or two finish running prior to certain apps successfully deploying. I'm sure this is a beyond basic & stupid question, but I can't find any spot to set any kind of 'start-up on boot delay'. Sadly if apps try to auto start while script is running then they'll be stuck in a deploy loop & require to be manually stopped & started using either cli or gui - which is a pain.
 
Joined
Jan 7, 2015
Messages
1,155
Just set the scripts to run post init in GUI>Tasks>INIT/SHUTDOWN Scripts. In the script utilize a sleep command if needed. If its a jail you want to start after a full boot or wait or whatnot, uncheck its option to auto start it, and instead start it also in one of your scripts in proper order. I see now however that you run scale so these instructions might not be valid for you, myself having never tried scale at all. But there is absolutely something similar.
 

Fleshmauler

Explorer
Joined
Jan 26, 2022
Messages
79
I remember the same from Core - but I straight can't find any similar options for auto start in Scale. I believe I've looked over just about everything available in the GUI, but decided that I have some inane blindspot; hence reaching out on the forms for someone to cure my lack of progress on this mild inconvenience.
 
Joined
Jan 7, 2015
Messages
1,155
Ive spent too much time learning BSD and while proficient in Linux these are the reasons i wont be switching. Im now having to train myself to stop answering Scale questions with Core knowledge.
 

Fleshmauler

Explorer
Joined
Jan 26, 2022
Messages
79
All good man, I appreciate any attempts - never know when advice pushes you in the right direction
 

sretalla

Powered by Neutrality
Moderator
Joined
Jan 1, 2016
Messages
9,703
Maybe running a script like this on startup (post-init)

Code:
#! /usr/bin/bash

# stop your apps in case they were already starting from last session state
midclt call chart.release.scale 'appname' '{"replica_count":0}'
midclt call chart.release.scale 'appname2' '{"replica_count":0}'

# do your necessary tasks
...

# start your apps
midclt call chart.release.scale 'appname' '{"replica_count":1}'
midclt call chart.release.scale 'appname2' '{"replica_count":1}'


You could also run a shutdown script to set them all to stop to avoid startup problems...

Code:
#! /usr/bin/bash

# stop your apps to ensure a clean start next time
midclt call chart.release.scale 'appname' '{"replica_count":0}'
midclt call chart.release.scale 'appname2' '{"replica_count":0}'
 

Fleshmauler

Explorer
Joined
Jan 26, 2022
Messages
79
@sretalla Much appreciated sir, will add it to my script & check it does the needful!
 

Fleshmauler

Explorer
Joined
Jan 26, 2022
Messages
79
Maybe running a script like this on startup (post-init)

Code:
#! /usr/bin/bash

# stop your apps in case they were already starting from last session state
midclt call chart.release.scale 'appname' '{"replica_count":0}'
midclt call chart.release.scale 'appname2' '{"replica_count":0}'

# do your necessary tasks
...

# start your apps
midclt call chart.release.scale 'appname' '{"replica_count":1}'
midclt call chart.release.scale 'appname2' '{"replica_count":1}'


You could also run a shutdown script to set them all to stop to avoid startup problems...

Code:
#! /usr/bin/bash

# stop your apps to ensure a clean start next time
midclt call chart.release.scale 'appname' '{"replica_count":0}'
midclt call chart.release.scale 'appname2' '{"replica_count":0}'
This worked perfectly - much appreciated! Was doing some routine cleaning & had to power off during - came back up & finally works as expected after adding those lines to my script!
 
Top